OSDN Git Service

PR c++/46552
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 21 Jan 2011 18:59:40 +0000 (18:59 +0000)
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 21 Jan 2011 18:59:40 +0000 (18:59 +0000)
* semantics.c (cxx_eval_constant_expression): Handle OFFSET_REF.

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

gcc/cp/ChangeLog
gcc/cp/semantics.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/constexpr-regress2.C [new file with mode: 0644]

index dcf8c49..08d7a6d 100644 (file)
@@ -1,5 +1,8 @@
 2011-01-21  Jason Merrill  <jason@redhat.com>
 
+       PR c++/46552
+       * semantics.c (cxx_eval_constant_expression): Handle OFFSET_REF.
+
        PR c++/46977
        * semantics.c (potential_constant_expression_1): Split out from
        potential_constant_expression.  Add want_rval parm.  Handle
index 23ff27b..fa35d4a 100644 (file)
@@ -7024,6 +7024,7 @@ cxx_eval_constant_expression (const constexpr_call *call, tree t,
     case NON_DEPENDENT_EXPR:
     case BASELINK:
     case EXPR_STMT:
+    case OFFSET_REF:
       if (!allow_non_constant)
         error_at (EXPR_LOC_OR_HERE (t),
                  "expression %qE is not a constant-expression", t);
index df43d93..09b657a 100644 (file)
@@ -1,5 +1,8 @@
 2011-01-21  Jason Merrill  <jason@redhat.com>
 
+       PR c++/46552
+       * g++.dg/cpp0x/constexpr-regress2.C: New.
+
        * g++.dg/cpp0x/constexpr-stmtexpr.C: New.
 
 2011-01-21  Jeff Law <law@redhat.com>
diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-regress2.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-regress2.C
new file mode 100644 (file)
index 0000000..470ee1c
--- /dev/null
@@ -0,0 +1,13 @@
+// PR c++/46552
+// { dg-options -std=c++0x }
+
+struct S
+{
+    int x;
+};
+
+template < typename >
+void f( void )
+{
+    &S::x;
+}