From: Jason Merrill Date: Mon, 6 Jun 2011 19:42:38 +0000 (-0400) Subject: re PR c++/49298 ([C++0x] sorry, unimplemented: unexpected ast of kind field_decl) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a651bcbe5e945d5e6f4f9597b400040bed984460;p=gcc.git re PR c++/49298 ([C++0x] sorry, unimplemented: unexpected ast of kind field_decl) PR c++/49298 * semantics.c (potential_constant_expression_1): Handle FIELD_DECL. From-SVN: r174721 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 9d0b8f0d9f8..dbe6ffbc555 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,8 @@ 2011-06-06 Jason Merrill + PR c++/49298 + * semantics.c (potential_constant_expression_1): Handle FIELD_DECL. + PR objc++/49221 * decl.c (cp_finish_decl): Check DECL_FUNCTION_SCOPE_P rather than at_function_scope_p. diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index ca9cf4bd130..ebca840ea2e 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -7489,6 +7489,8 @@ potential_constant_expression_1 (tree t, bool want_rval, tsubst_flags_t flags) case TEMPLATE_PARM_INDEX: case TRAIT_EXPR: case IDENTIFIER_NODE: + /* We can see a FIELD_DECL in a pointer-to-member expression. */ + case FIELD_DECL: return true; case PARM_DECL: diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 761935012ab..7d9a9c2ef9f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2011-06-06 Jason Merrill + + * g++.dg/cpp0x/regress/ptrmem1.C: New. + 2011-06-06 Richard Sandiford PR rtl-optimization/49145 diff --git a/gcc/testsuite/g++.dg/cpp0x/regress/ptrmem1.C b/gcc/testsuite/g++.dg/cpp0x/regress/ptrmem1.C new file mode 100644 index 00000000000..873000b9c38 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/regress/ptrmem1.C @@ -0,0 +1,9 @@ +// PR c++/49298 +// { dg-options -std=c++0x } + +template struct B { }; +template struct A +{ + int i; + B b; +};