diff options
author | Jason Merrill <jason@redhat.com> | 2011-02-14 16:52:24 -0500 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2011-02-14 16:52:24 -0500 |
commit | c9e71b36cfef620a506f37e5922f1cf68c7869a8 (patch) | |
tree | 3f1f70c2b7ef7068bf0c900a03e3380d42af6abb /gcc | |
parent | b09c308168b572a21c7b540117358f3e2b470ce5 (diff) | |
download | gcc-c9e71b36cfef620a506f37e5922f1cf68c7869a8.zip gcc-c9e71b36cfef620a506f37e5922f1cf68c7869a8.tar.gz gcc-c9e71b36cfef620a506f37e5922f1cf68c7869a8.tar.bz2 |
re PR c++/47482 ([C++0x] ICE: unexpected expression ‘sizeof ("A")’ of kind sizeof_expr)
PR c++/47482
* parser.c (cp_parser_enumerator_definition): Call
fold_non_dependent_expr.
From-SVN: r170156
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/parser.c | 4 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/regress/enum1.C | 8 |
4 files changed, 22 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index c3f780a..61a3e4a 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2011-02-14 Jason Merrill <jason@redhat.com> + + PR c++/47482 + * parser.c (cp_parser_enumerator_definition): Call + fold_non_dependent_expr. + 2011-02-09 Jason Merrill <jason@redhat.com> * decl.c (cp_make_fname_decl): Set DECL_THIS_STATIC at toplevel. diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 11039b8..8f4a121 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -13763,6 +13763,10 @@ cp_parser_enumerator_definition (cp_parser* parser, tree type) if (check_for_bare_parameter_packs (value)) value = error_mark_node; + /* integral_constant_value will pull out this expression, so make sure + it's folded as appropriate. */ + value = fold_non_dependent_expr (value); + /* Create the enumerator. */ build_enumerator (identifier, value, type, loc); } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 9d200a4..cd73643 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2011-02-14 Jason Merrill <jason@redhat.com> + + * g++.dg/cpp0x/regress/enum1.C: New. + 2011-02-14 Eric Botcazou <ebotcazou@adacore.com> * gnat.dg/include.adb: New test. diff --git a/gcc/testsuite/g++.dg/cpp0x/regress/enum1.C b/gcc/testsuite/g++.dg/cpp0x/regress/enum1.C new file mode 100644 index 0000000..6e29f9e --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/regress/enum1.C @@ -0,0 +1,8 @@ +// PR c++/47482 +// { dg-options -std=c++0x } + +template<class> +struct K +{ + enum { A = sizeof"A", B = +A }; +}; |