From 44de00a16368ac628012620980936d341d35aedc Mon Sep 17 00:00:00 2001 From: paolo Date: Mon, 6 Nov 2017 17:45:55 +0000 Subject: /cp 2017-11-06 Paolo Carlini PR c++/65579 * decl2.c (finish_static_data_member_decl): If there's an initializer, complete the type and re-apply the quals. /testsuite 2017-11-06 Paolo Carlini PR c++/65579 * g++.dg/cpp0x/constexpr-template11.C: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@254461 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cp/decl2.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'gcc/cp/decl2.c') diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index a23b96c53e7..0b183085e0e 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -787,6 +787,15 @@ finish_static_data_member_decl (tree decl, && TYPE_DOMAIN (TREE_TYPE (decl)) == NULL_TREE) SET_VAR_HAD_UNKNOWN_BOUND (decl); + if (init) + { + /* Similarly to start_decl_1, we want to complete the type in order + to do the right thing in cp_apply_type_quals_to_decl, possibly + clear TYPE_QUAL_CONST (c++/65579). */ + tree type = TREE_TYPE (decl) = complete_type (TREE_TYPE (decl)); + cp_apply_type_quals_to_decl (cp_type_quals (type), decl); + } + cp_finish_decl (decl, init, init_const_expr_p, asmspec_tree, flags); } -- cgit v1.2.1