Commit e843f189 by Jakub Jelinek Committed by Jakub Jelinek

re PR c++/89403 (ICE in maybe_clone_body, at cp/optimize.c:693)

	PR c++/89403
	* decl2.c (c_parse_final_cleanups): Move TREE_ASM_WRITTEN setting
	for flag_syntax_only from here...
	* semantics.c (expand_or_defer_fn_1): ... here.

	* g++.dg/cpp0x/pr89403.C: New test.

From-SVN: r269059
parent 73ab3eb7
2019-02-20 Jakub Jelinek <jakub@redhat.com> 2019-02-20 Jakub Jelinek <jakub@redhat.com>
PR c++/89403
* decl2.c (c_parse_final_cleanups): Move TREE_ASM_WRITTEN setting
for flag_syntax_only from here...
* semantics.c (expand_or_defer_fn_1): ... here.
PR c++/89405 PR c++/89405
* decl.c (maybe_commonize_var): When clearing TREE_PUBLIC and * decl.c (maybe_commonize_var): When clearing TREE_PUBLIC and
DECL_COMMON, set DECL_INTERFACE_KNOWN. DECL_COMMON, set DECL_INTERFACE_KNOWN.
......
...@@ -4965,11 +4965,6 @@ c_parse_final_cleanups (void) ...@@ -4965,11 +4965,6 @@ c_parse_final_cleanups (void)
/* Generate RTL for this function now that we know we /* Generate RTL for this function now that we know we
need it. */ need it. */
expand_or_defer_fn (decl); expand_or_defer_fn (decl);
/* If we're compiling -fsyntax-only pretend that this
function has been written out so that we don't try to
expand it again. */
if (flag_syntax_only)
TREE_ASM_WRITTEN (decl) = 1;
reconsider = true; reconsider = true;
} }
} }
......
...@@ -4352,7 +4352,12 @@ expand_or_defer_fn_1 (tree fn) ...@@ -4352,7 +4352,12 @@ expand_or_defer_fn_1 (tree fn)
/* There's no reason to do any of the work here if we're only doing /* There's no reason to do any of the work here if we're only doing
semantic analysis; this code just generates RTL. */ semantic analysis; this code just generates RTL. */
if (flag_syntax_only) if (flag_syntax_only)
return false; {
/* Pretend that this function has been written out so that we don't try
to expand it again. */
TREE_ASM_WRITTEN (fn) = 1;
return false;
}
return true; return true;
} }
......
2019-02-20 Jakub Jelinek <jakub@redhat.com> 2019-02-20 Jakub Jelinek <jakub@redhat.com>
PR c++/89403
* g++.dg/cpp0x/pr89403.C: New test.
PR c++/89405 PR c++/89405
* g++.dg/cpp1z/inline-var5.C: New test. * g++.dg/cpp1z/inline-var5.C: New test.
......
// PR c++/89403
// { dg-do compile { target c++11 } }
// { dg-options "-Os -fsyntax-only" }
template <typename T>
struct A : T {
constexpr A() : T() { }
};
template <typename T>
struct B {
A<T> b;
constexpr B() { }
};
struct C { struct {} s; };
constexpr B<C> b{};
constexpr C c = b.b;
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