On 11/10/2011 02:12 AM, Jason Merrill wrote:
On 11/09/2011 07:56 PM, Paolo Carlini wrote:
- /*allow_non_integral_constant_expression_p=*/false,
+                     /*allow_non_integral_constant_expression_p=*/true,

This should be (cxx_dialect >= cxx0x) rather than true.

Sure, we can do that (template/nontype13.C still has to be tweaked a bit for the C++11 pass of testsuite). I'm finishing testing the below, Ok?

Thanks,
Paolo.

/////////////////////
/cp
2011-11-10  Paolo Carlini  <paolo.carl...@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-10  Paolo Carlini  <paolo.carl...@oracle.com>

        PR c++/50837
        * g++.dg/cpp0x/static_assert5.C: New.
        * g++.dg/template/nontype13.C: Tweak.
Index: testsuite/g++.dg/cpp0x/static_assert5.C
===================================================================
--- testsuite/g++.dg/cpp0x/static_assert5.C     (revision 0)
+++ testsuite/g++.dg/cpp0x/static_assert5.C     (revision 0)
@@ -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: testsuite/g++.dg/template/nontype13.C
===================================================================
--- testsuite/g++.dg/template/nontype13.C       (revision 181246)
+++ testsuite/g++.dg/template/nontype13.C       (working copy)
@@ -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
Index: cp/pt.c
===================================================================
--- cp/pt.c     (revision 181247)
+++ cp/pt.c     (working copy)
@@ -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,

Reply via email to