PR c++/89405
* decl.c (maybe_commonize_var): When clearing TREE_PUBLIC and
DECL_COMMON, set DECL_INTERFACE_KNOWN.
* g++.dg/cpp1z/inline-var5.C: New test.
From-SVN: r269058
2019-02-20 Jakub Jelinek <jakub@redhat.com>
+ PR c++/89405
+ * decl.c (maybe_commonize_var): When clearing TREE_PUBLIC and
+ DECL_COMMON, set DECL_INTERFACE_KNOWN.
+
PR c++/89336
* constexpr.c (cxx_eval_store_expression): Diagnose changing of active
union member for -std=c++17 and earlier.
be merged. */
TREE_PUBLIC (decl) = 0;
DECL_COMMON (decl) = 0;
+ DECL_INTERFACE_KNOWN (decl) = 1;
const char *msg;
if (DECL_INLINE_VAR_P (decl))
msg = G_("sorry: semantics of inline variable "
2019-02-20 Jakub Jelinek <jakub@redhat.com>
+ PR c++/89405
+ * g++.dg/cpp1z/inline-var5.C: New test.
+
PR middle-end/89412
* gcc.c-torture/compile/pr89412.c: New test.
--- /dev/null
+// PR c++/89405
+// { dg-do compile { target c++17 } }
+// { dg-options "-fno-weak" }
+
+template <int N>
+struct S
+{
+ static constexpr int a = N; // { dg-warning "semantics of inline variable" }
+}; // { dg-message "you can work around this" "" { target *-*-* } .-1 }
+
+const int *x = &S<0>::a;