diff options
| author | mmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-09-16 18:33:22 +0000 |
|---|---|---|
| committer | mmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-09-16 18:33:22 +0000 |
| commit | ef792945841ca51df53ffc0abea25fa938180e5d (patch) | |
| tree | 6c9c0e8718da769835c6cf3787e026c2fe767eb4 /gcc | |
| parent | 6ca5262452ea0561831ac32c3310ffac1d681ca4 (diff) | |
| download | ppe42-gcc-ef792945841ca51df53ffc0abea25fa938180e5d.tar.gz ppe42-gcc-ef792945841ca51df53ffc0abea25fa938180e5d.zip | |
PR c++/23914
* parser.c (cp_parser_enclosed_template_argument_list): Make sure
skip_evaluation is false when processing template arguments.
PR c++/23914
* g++.dg/template/static18.C: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@104350 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
| -rw-r--r-- | gcc/cp/ChangeLog | 4 | ||||
| -rw-r--r-- | gcc/cp/parser.c | 6 | ||||
| -rw-r--r-- | gcc/testsuite/ChangeLog | 3 | ||||
| -rw-r--r-- | gcc/testsuite/g++.dg/template/static18.C | 13 |
4 files changed, 26 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 91dc40597f2..0680431367d 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2005-09-16 Mark Mitchell <mark@codesourcery.com> + PR c++/23914 + * parser.c (cp_parser_enclosed_template_argument_list): Make sure + skip_evaluation is false when processing template arguments. + PR c++/21514 * pt.c (check_instantiated_args): Treat uses of anonymous types as causing type-deduction failure. diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 0f8d17cd504..7284d4b84b8 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -15411,6 +15411,7 @@ cp_parser_enclosed_template_argument_list (cp_parser* parser) tree saved_qualifying_scope; tree saved_object_scope; bool saved_greater_than_is_operator_p; + bool saved_skip_evaluation; /* [temp.names] @@ -15425,6 +15426,10 @@ cp_parser_enclosed_template_argument_list (cp_parser* parser) saved_scope = parser->scope; saved_qualifying_scope = parser->qualifying_scope; saved_object_scope = parser->object_scope; + /* We need to evaluate the template arguments, even though this + template-id may be nested within a "sizeof". */ + saved_skip_evaluation = skip_evaluation; + skip_evaluation = false; /* Parse the template-argument-list itself. */ if (cp_lexer_next_token_is (parser->lexer, CPP_GREATER)) arguments = NULL_TREE; @@ -15474,6 +15479,7 @@ cp_parser_enclosed_template_argument_list (cp_parser* parser) parser->scope = saved_scope; parser->qualifying_scope = saved_qualifying_scope; parser->object_scope = saved_object_scope; + skip_evaluation = saved_skip_evaluation; return arguments; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 6103389ca2b..7bb4fb1a793 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2005-09-16 Mark Mitchell <mark@codesourcery.com> + PR c++/23914 + * g++.dg/template/static18.C: New test. + PR c++/21514 * g++.dg/template/crash19.C: Remove dg-error marker. * g++.dg/template/local4.C: New test. diff --git a/gcc/testsuite/g++.dg/template/static18.C b/gcc/testsuite/g++.dg/template/static18.C new file mode 100644 index 00000000000..2a2ace93914 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/static18.C @@ -0,0 +1,13 @@ +// PR c++/23914 + +template <class T> +struct foo_template { + static const unsigned complexity = 0; +}; + +template <int x> struct STATIC_ASSERTION {}; + +void gcc_402_problem_minimal() +{ + sizeof(STATIC_ASSERTION< foo_template<int>::complexity >); +} |

