PR c++/47511
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 10 Feb 2011 16:29:39 +0000 (16:29 +0000)
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 10 Feb 2011 16:29:39 +0000 (16:29 +0000)
* semantics.c (potential_constant_expression_1): Handle TEMPLATE_DECL.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@170005 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/semantics.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/regress/README [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp0x/regress/regress1.C [moved from gcc/testsuite/g++.dg/cpp0x/constexpr-regress1.C with 100% similarity]
gcc/testsuite/g++.dg/cpp0x/regress/regress2.C [moved from gcc/testsuite/g++.dg/cpp0x/constexpr-regress2.C with 100% similarity]
gcc/testsuite/g++.dg/cpp0x/regress/regress3.C [new file with mode: 0644]

index 6dd6137..f247933 100644 (file)
@@ -1,3 +1,8 @@
+2011-02-09  Jason Merrill  <jason@redhat.com>
+
+       PR c++/47511
+       * semantics.c (potential_constant_expression_1): Handle TEMPLATE_DECL.
+
 2011-02-03  Dodji Seketeli  <dodji@redhat.com>
 
        PR c++/47398
index 6d45fb9..7c06cc3 100644 (file)
@@ -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:
index 649a0b7..c37a273 100644 (file)
@@ -1,3 +1,10 @@
+2011-02-09  Jason Merrill  <jason@redhat.com>
+
+       * 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  <rguenther@suse.de>
 
        PR tree-optimization/47677
diff --git a/gcc/testsuite/g++.dg/cpp0x/regress/README b/gcc/testsuite/g++.dg/cpp0x/regress/README
new file mode 100644 (file)
index 0000000..5c3402e
--- /dev/null
@@ -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/regress3.C b/gcc/testsuite/g++.dg/cpp0x/regress/regress3.C
new file mode 100644 (file)
index 0000000..ffbb97f
--- /dev/null
@@ -0,0 +1,13 @@
+// PR c++/47511
+// { dg-options -std=c++0x }
+
+namespace N {
+    template <typename T> bool g( T ) {
+        return true;
+    }
+    struct A { };
+}
+template <class T> void f(const T&) {
+    N::A x;
+    g(x) ;
+}