diff options
author | Marek Polacek <polacek@redhat.com> | 2019-09-05 15:37:52 +0000 |
---|---|---|
committer | Marek Polacek <mpolacek@gcc.gnu.org> | 2019-09-05 15:37:52 +0000 |
commit | bb64bef659dc5b11fe1f8ff1f7df65603c9d8876 (patch) | |
tree | 4915ab25b64bdbc9959c1361e1c0ad9dc63ec1d2 /gcc/cp/decl.c | |
parent | b2c113aed6f2ae2fca28cd5a8fab9c857b97dd2b (diff) | |
download | gcc-bb64bef659dc5b11fe1f8ff1f7df65603c9d8876.zip gcc-bb64bef659dc5b11fe1f8ff1f7df65603c9d8876.tar.gz gcc-bb64bef659dc5b11fe1f8ff1f7df65603c9d8876.tar.bz2 |
PR c++/91644 - ICE with constinit in function template.
* decl.c (start_decl): Call retrofit_lang_decl for constinit variables.
* pt.c (tsubst_expr): Pass LOOKUP_CONSTINIT down to cp_finish_decl for
constinit variables.
* g++.dg/cpp2a/constinit13.C: New test.
From-SVN: r275421
Diffstat (limited to 'gcc/cp/decl.c')
-rw-r--r-- | gcc/cp/decl.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 6de95cd..825e1e6 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -5308,7 +5308,14 @@ start_decl (const cp_declarator *declarator, decl = maybe_push_decl (decl); if (processing_template_decl) - decl = push_template_decl (decl); + { + /* Make sure that for a `constinit' decl push_template_decl creates + a DECL_TEMPLATE_INFO info for us, so that cp_finish_decl can then set + TINFO_VAR_DECLARED_CONSTINIT. */ + if (decl_spec_seq_has_spec_p (declspecs, ds_constinit)) + retrofit_lang_decl (decl); + decl = push_template_decl (decl); + } if (decl == error_mark_node) return error_mark_node; |