PR c++/85134
* decl.c (cp_finish_decl): If ensure_literal_type_for_constexpr_object
fails, after clearing DECL_DECLARED_CONSTEXPR_P don't return early,
instead for static data members clear init and set DECL_EXTERNAL.
* g++.dg/gomp/pr85134.C: New test.
* g++.dg/cpp0x/constexpr-ice19.C: Expect one further error.
From-SVN: r259038
+2018-04-03 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/85134
+ * decl.c (cp_finish_decl): If ensure_literal_type_for_constexpr_object
+ fails, after clearing DECL_DECLARED_CONSTEXPR_P don't return early,
+ instead for static data members clear init and set DECL_EXTERNAL.
+
2018-04-02 Jason Merrill <jason@redhat.com>
PR c++/64095 - auto... parameter pack.
cp_apply_type_quals_to_decl (cp_type_quals (type), decl);
}
- if (ensure_literal_type_for_constexpr_object (decl)
- == error_mark_node)
+ if (ensure_literal_type_for_constexpr_object (decl) == error_mark_node)
{
DECL_DECLARED_CONSTEXPR_P (decl) = 0;
- return;
+ if (VAR_P (decl) && DECL_CLASS_SCOPE_P (decl))
+ {
+ init = NULL_TREE;
+ DECL_EXTERNAL (decl) = 1;
+ }
}
if (VAR_P (decl)
2018-04-03 Jakub Jelinek <jakub@redhat.com>
+ PR c++/85134
+ * g++.dg/gomp/pr85134.C: New test.
+ * g++.dg/cpp0x/constexpr-ice19.C: Expect one further error.
+
PR target/85169
* gcc.c-torture/execute/pr85169.c: New test.
* gcc.target/i386/avx512f-pr85169.c: New test.
struct B
{
- static constexpr A a {}; // { dg-error "not literal" }
+ static constexpr A a {}; // { dg-error "not literal|in-class initialization" }
};
--- /dev/null
+// PR c++/85134
+// { dg-do compile }
+// { dg-options "-std=c++14 -fopenmp" }
+
+void
+foo (int i)
+{
+ constexpr int x[i] = {}; // { dg-error "'constexpr' variable 'x' has variably-modified type" }
+#pragma omp parallel shared(x)
+ ;
+}