OSDN Git Service

/cp
authorpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 10 Nov 2011 02:27:16 +0000 (02:27 +0000)
committerpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 10 Nov 2011 02:27:16 +0000 (02:27 +0000)
2011-11-09  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/50837
* pt.c (tsubst_copy_and_build) [IDENTIFIER_NODE]: In C++11 mode
pass allow_non_integral_constant_expression_p = true to
finish_id_expression.

/testsuite
2011-11-09  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/50837
* g++.dg/cpp0x/static_assert5.C: New.
* g++.dg/template/nontype13.C: Tweak.

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

gcc/cp/ChangeLog
gcc/cp/pt.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/static_assert5.C [new file with mode: 0644]
gcc/testsuite/g++.dg/template/nontype13.C

index 406f77c..33bfa33 100644 (file)
@@ -1,3 +1,10 @@
+2011-11-09  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/50837
+       * pt.c (tsubst_copy_and_build) [IDENTIFIER_NODE]: In C++11 mode
+       pass allow_non_integral_constant_expression_p = true to
+       finish_id_expression.
+
 2011-11-09  Jason Merrill  <jason@redhat.com>
 
        PR c++/50972
index 55eba5a..da5497e 100644 (file)
@@ -13233,7 +13233,7 @@ tsubst_copy_and_build (tree t,
        decl = finish_id_expression (t, decl, NULL_TREE,
                                     &idk,
                                     integral_constant_expression_p,
-                                    /*allow_non_integral_constant_expression_p=*/false,
+          /*allow_non_integral_constant_expression_p=*/(cxx_dialect >= cxx0x),
                                     &non_integral_constant_expression_p,
                                     /*template_p=*/false,
                                     /*done=*/true,
index 0f71e67..c5004a4 100644 (file)
@@ -1,3 +1,9 @@
+2011-11-09  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/50837
+       * g++.dg/cpp0x/static_assert5.C: New.
+       * g++.dg/template/nontype13.C: Tweak.
+
 2011-11-09  Jason Merrill  <jason@redhat.com>
 
        PR c++/50972
@@ -25,7 +31,7 @@
 
 2011-11-09  Patrick Marlier  <patrick.marlier@gmail.com>
 
-       * gcc.dg/tm/memopt-1.c:  Adjust regexp. 
+       * gcc.dg/tm/memopt-1.c:  Adjust regexp.
 
 2011-11-09  Jason Merrill  <jason@redhat.com>
 
diff --git a/gcc/testsuite/g++.dg/cpp0x/static_assert5.C b/gcc/testsuite/g++.dg/cpp0x/static_assert5.C
new file mode 100644 (file)
index 0000000..b918796
--- /dev/null
@@ -0,0 +1,21 @@
+// PR c++/50837
+// { dg-options "-std=c++0x" }
+
+template<class T>
+struct z
+{
+  static constexpr bool test_constexpr()
+  {
+    return true;
+  }
+
+  static void test()
+  {
+    static_assert(test_constexpr(), "test1");
+  }
+};
+
+int main()
+{
+  z<int>::test();
+}
index 4b3e862..d604da9 100644 (file)
@@ -11,7 +11,7 @@ struct Dummy
   template<bool B>
   void tester()
   {
-    bar<evil>()(); // { dg-error "constant" }
+    bar<evil>()(); // { dg-error "constant|template" }
   }
   template<bool B>
   struct bar