commit 65488b9842de11454371c9d75652f58cab3465d4
Author: Jason Merrill <jason@redhat.com>
Date: Thu Jun 11 09:51:19 2015 -0400
PR c++/66445
* constexpr.c (potential_constant_expression_1): Handle a
DECL_EXPR of TYPE_DECL.
@@ -4462,6 +4462,11 @@ potential_constant_expression_1 (tree t, bool want_rval, bool strict,
}
return false;
+ case TYPE_DECL:
+ case TAG_DEFN:
+ /* We can see these in statement-expressions. */
+ return true;
+
default:
if (objc_is_property_ref (t))
return false;
new file mode 100644
@@ -0,0 +1,7 @@
+// PR c++/66445
+// { dg-options "" }
+
+template <typename> void foo ()
+{
+ int a = ({ struct A{} b; 42; });
+}