Commit 73ab3eb7 by Jakub Jelinek Committed by Jakub Jelinek

re PR c++/89405 (ICE in import_export_decl, at cp/decl2.c:2959)

	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
parent 37d7267f
2019-02-20 Jakub Jelinek <jakub@redhat.com> 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 PR c++/89336
* constexpr.c (cxx_eval_store_expression): Diagnose changing of active * constexpr.c (cxx_eval_store_expression): Diagnose changing of active
union member for -std=c++17 and earlier. union member for -std=c++17 and earlier.
......
...@@ -5634,6 +5634,7 @@ maybe_commonize_var (tree decl) ...@@ -5634,6 +5634,7 @@ maybe_commonize_var (tree decl)
be merged. */ be merged. */
TREE_PUBLIC (decl) = 0; TREE_PUBLIC (decl) = 0;
DECL_COMMON (decl) = 0; DECL_COMMON (decl) = 0;
DECL_INTERFACE_KNOWN (decl) = 1;
const char *msg; const char *msg;
if (DECL_INLINE_VAR_P (decl)) if (DECL_INLINE_VAR_P (decl))
msg = G_("sorry: semantics of inline variable " msg = G_("sorry: semantics of inline variable "
......
2019-02-20 Jakub Jelinek <jakub@redhat.com> 2019-02-20 Jakub Jelinek <jakub@redhat.com>
PR c++/89405
* g++.dg/cpp1z/inline-var5.C: New test.
PR middle-end/89412 PR middle-end/89412
* gcc.c-torture/compile/pr89412.c: New test. * gcc.c-torture/compile/pr89412.c: New test.
......
// 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;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment