]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/53839 ([C++11] internal compiler error: in adjust_temp_type, at cp/semantic...
authorJason Merrill <jason@redhat.com>
Thu, 13 Sep 2012 15:14:08 +0000 (11:14 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Thu, 13 Sep 2012 15:14:08 +0000 (11:14 -0400)
PR c++/53839
* semantics.c (cxx_eval_indirect_ref): If we aren't looking for an
address, make sure the value is constant.

From-SVN: r191263

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

index 6d135a35b44b050034192916907b933198782242..55b80c8c208e0bd41fce02a6b36f97b024160a3f 100644 (file)
@@ -1,5 +1,9 @@
 2012-09-13  Jason Merrill  <jason@redhat.com>
 
+       PR c++/53839
+       * semantics.c (cxx_eval_indirect_ref): If we aren't looking for an
+       address, make sure the value is constant.
+
        PR c++/54511
        * pt.c (tsubst_decl) [VAR_DECL]: Handle DECL_ANON_UNION_VAR_P.
 
index a6cdfb5688900fd05ec268574671dd800a05c1a4..d19ff1cfaa9a3503ed505434eb37b403071cd264 100644 (file)
@@ -7474,7 +7474,11 @@ cxx_eval_indirect_ref (const constexpr_call *call, tree t,
     }
 
   if (r == NULL_TREE)
-    return t;
+    {
+      if (!addr)
+       VERIFY_CONSTANT (t);
+      return t;
+    }
   return r;
 }
 
index 3b813a3f0148548a137ec35f1bbd1571615c1f7d..0820a05bfd1855b5e4693cba411c326cc2e8a9c2 100644 (file)
@@ -1,5 +1,8 @@
 2012-09-13  Jason Merrill  <jason@redhat.com>
 
+       PR c++/53839
+       * g++.dg/cpp0x/constexpr-temp1.C: New.
+
        PR c++/54511
        * g++.dg/template/anonunion2.C: New.
 
diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-temp1.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-temp1.C
new file mode 100644 (file)
index 0000000..d065436
--- /dev/null
@@ -0,0 +1,9 @@
+// { dg-do compile { target c++11 } }
+
+struct A { int i; };
+constexpr A f2 (const A& a) { return a; }
+constexpr int f1 (const A &a) { return f2(a).i; }
+A g(const A &a)
+{
+  return { f1(a) };
+}