+2020-04-17 Marek Polacek <polacek@redhat.com>
+
+ PR c++/94592
+ * constexpr.c (cxx_eval_outermost_constant_expr): Return when T is
+ a BRACE_ENCLOSED_INITIALIZER_P.
+ (is_nondependent_constant_expression): Don't check
+ BRACE_ENCLOSED_INITIALIZER_P.
+ (is_nondependent_static_init_expression): Likewise.
+
2020-04-20 Patrick Palka <ppalka@redhat.com>
PR c++/94628
bool non_constant_p = false;
bool overflow_p = false;
+ if (BRACE_ENCLOSED_INITIALIZER_P (t))
+ {
+ gcc_checking_assert (allow_non_constant);
+ return t;
+ }
+
constexpr_global_ctx global_ctx;
constexpr_ctx ctx = { &global_ctx, NULL, NULL, NULL, NULL, NULL, NULL,
allow_non_constant, strict,
is_nondependent_constant_expression (tree t)
{
return (!type_unknown_p (t)
- && !BRACE_ENCLOSED_INITIALIZER_P (t)
&& is_constant_expression (t)
&& !instantiation_dependent_expression_p (t));
}
is_nondependent_static_init_expression (tree t)
{
return (!type_unknown_p (t)
- && !BRACE_ENCLOSED_INITIALIZER_P (t)
&& is_static_init_expression (t)
&& !instantiation_dependent_expression_p (t));
}
+2020-04-17 Marek Polacek <polacek@redhat.com>
+
+ PR c++/94592
+ * g++.dg/cpp2a/nontype-class34.C: New test.
+ * g++.dg/cpp2a/nontype-class35.C: New test.
+
2020-04-20 Patrick Palka <ppalka@redhat.com>
PR c++/94628
--- /dev/null
+// PR c++/94592 - ICE with { } as template argument.
+// { dg-do compile { target c++2a } }
+
+struct A {
+ constexpr A() {}
+};
+
+template <A> struct B { };
+
+template<typename> void bar () {
+ B<{}> var;
+}
+
+void fu() {
+ bar<int>();
+}
--- /dev/null
+// PR c++/94592 - ICE with { } as template argument.
+// { dg-do compile { target c++2a } }
+
+struct A {
+ int i;
+ constexpr A(int n) : i(n) {}
+};
+
+template <A a> struct B { int i; constexpr B() : i(a.i) { } };
+
+template<typename> void bar () {
+ B<{1}> var;
+}
+
+void fu() {
+ bar<int>();
+}