From 5b883ca61cf968fa32782309aa3750511b549889 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Thu, 10 Feb 2011 11:29:39 -0500 Subject: re PR c++/47511 ([C++0x] ICE: unexpected ast of kind template_decl in potential_constant_expression_1, at cp/semantics.c:7711) PR c++/47511 * semantics.c (potential_constant_expression_1): Handle TEMPLATE_DECL. From-SVN: r170005 --- gcc/cp/ChangeLog | 5 +++++ gcc/cp/semantics.c | 1 + gcc/testsuite/ChangeLog | 7 +++++++ gcc/testsuite/g++.dg/cpp0x/constexpr-regress1.C | 10 ---------- gcc/testsuite/g++.dg/cpp0x/constexpr-regress2.C | 13 ------------- gcc/testsuite/g++.dg/cpp0x/regress/README | 3 +++ gcc/testsuite/g++.dg/cpp0x/regress/regress1.C | 10 ++++++++++ gcc/testsuite/g++.dg/cpp0x/regress/regress2.C | 13 +++++++++++++ gcc/testsuite/g++.dg/cpp0x/regress/regress3.C | 13 +++++++++++++ 9 files changed, 52 insertions(+), 23 deletions(-) delete mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-regress1.C delete mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-regress2.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/regress/README create mode 100644 gcc/testsuite/g++.dg/cpp0x/regress/regress1.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/regress/regress2.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/regress/regress3.C (limited to 'gcc') diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 6dd6137..f247933 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2011-02-09 Jason Merrill + + PR c++/47511 + * semantics.c (potential_constant_expression_1): Handle TEMPLATE_DECL. + 2011-02-03 Dodji Seketeli PR c++/47398 diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 6d45fb9..7c06cc3 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -7263,6 +7263,7 @@ potential_constant_expression_1 (tree t, bool want_rval, tsubst_flags_t flags) { case FUNCTION_DECL: case BASELINK: + case TEMPLATE_DECL: case OVERLOAD: case TEMPLATE_ID_EXPR: case LABEL_DECL: diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 649a0b7..c37a273 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2011-02-09 Jason Merrill + + * g++.dg/cpp0x/regress: New directory. + * g++.dg/cpp0x/constexpr-regress1.C: Move to regress/regress1.C. + * g++.dg/cpp0x/constexpr-regress2.C: Move to regress/regress2.C. + * g++.dg/cpp0x/regress/regress3.C: New. + 2011-02-10 Richard Guenther PR tree-optimization/47677 diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-regress1.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-regress1.C deleted file mode 100644 index a6fe399..0000000 --- a/gcc/testsuite/g++.dg/cpp0x/constexpr-regress1.C +++ /dev/null @@ -1,10 +0,0 @@ -// PR c++/46903 -// This isn't C++0x code, but it was breaking in C++0x mode. -// { dg-options -std=c++0x } - -struct A {}; -struct B { - void *(*a)(); -}; -template void *CreateA() {} -B b = {CreateA}; diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-regress2.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-regress2.C deleted file mode 100644 index 470ee1c..0000000 --- a/gcc/testsuite/g++.dg/cpp0x/constexpr-regress2.C +++ /dev/null @@ -1,13 +0,0 @@ -// PR c++/46552 -// { dg-options -std=c++0x } - -struct S -{ - int x; -}; - -template < typename > -void f( void ) -{ - &S::x; -} diff --git a/gcc/testsuite/g++.dg/cpp0x/regress/README b/gcc/testsuite/g++.dg/cpp0x/regress/README new file mode 100644 index 0000000..5c3402e --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/regress/README @@ -0,0 +1,3 @@ +This directory contains tests that were passing in C++98 mode but failing +in C++0x mode; it should be replaced by an improvement to the test harness +to run all tests in both modes. diff --git a/gcc/testsuite/g++.dg/cpp0x/regress/regress1.C b/gcc/testsuite/g++.dg/cpp0x/regress/regress1.C new file mode 100644 index 0000000..a6fe399 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/regress/regress1.C @@ -0,0 +1,10 @@ +// PR c++/46903 +// This isn't C++0x code, but it was breaking in C++0x mode. +// { dg-options -std=c++0x } + +struct A {}; +struct B { + void *(*a)(); +}; +template void *CreateA() {} +B b = {CreateA}; diff --git a/gcc/testsuite/g++.dg/cpp0x/regress/regress2.C b/gcc/testsuite/g++.dg/cpp0x/regress/regress2.C new file mode 100644 index 0000000..470ee1c --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/regress/regress2.C @@ -0,0 +1,13 @@ +// PR c++/46552 +// { dg-options -std=c++0x } + +struct S +{ + int x; +}; + +template < typename > +void f( void ) +{ + &S::x; +} diff --git a/gcc/testsuite/g++.dg/cpp0x/regress/regress3.C b/gcc/testsuite/g++.dg/cpp0x/regress/regress3.C new file mode 100644 index 0000000..ffbb97f --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/regress/regress3.C @@ -0,0 +1,13 @@ +// PR c++/47511 +// { dg-options -std=c++0x } + +namespace N { + template bool g( T ) { + return true; + } + struct A { }; +} +template void f(const T&) { + N::A x; + g(x) ; +} -- cgit v1.1