From c9e71b36cfef620a506f37e5922f1cf68c7869a8 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Mon, 14 Feb 2011 16:52:24 -0500 Subject: [PATCH] =?utf8?q?re=20PR=20c++/47482=20([C++0x]=20ICE:=20unexpect?= =?utf8?q?ed=20expression=20=E2=80=98sizeof=20("A")=E2=80=99=20of=20kind?= =?utf8?q?=20sizeof=5Fexpr)?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit PR c++/47482 * parser.c (cp_parser_enumerator_definition): Call fold_non_dependent_expr. From-SVN: r170156 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/parser.c | 4 ++++ gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/g++.dg/cpp0x/regress/enum1.C | 8 ++++++++ 4 files changed, 22 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp0x/regress/enum1.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index c3f780abe04..61a3e4addc2 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2011-02-14 Jason Merrill + + PR c++/47482 + * parser.c (cp_parser_enumerator_definition): Call + fold_non_dependent_expr. + 2011-02-09 Jason Merrill * 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 11039b899cc..8f4a1219a73 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 9d200a419af..cd73643e916 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2011-02-14 Jason Merrill + + * g++.dg/cpp0x/regress/enum1.C: New. + 2011-02-14 Eric Botcazou * 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 00000000000..6e29f9ea923 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/regress/enum1.C @@ -0,0 +1,8 @@ +// PR c++/47482 +// { dg-options -std=c++0x } + +template +struct K +{ + enum { A = sizeof"A", B = +A }; +}; -- 2.30.2