Commit 65371a7e by Paolo Carlini Committed by Paolo Carlini

re PR c++/65579 ([C++11] gcc requires definition of a static constexpr member…

re PR c++/65579 ([C++11] gcc requires definition of a static constexpr member even though it is not odr-used)

/cp
2017-11-06  Paolo Carlini  <paolo.carlini@oracle.com>

	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  <paolo.carlini@oracle.com>

	PR c++/65579
	* g++.dg/cpp0x/constexpr-template11.C: New.

From-SVN: r254461
parent d3722bf7
2017-11-06 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/65579
* decl2.c (finish_static_data_member_decl): If there's an initializer,
complete the type and re-apply the quals.
2017-11-06 Martin Liska <mliska@suse.cz>
PR middle-end/82404
......
......@@ -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);
}
......
2017-11-06 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/65579
* g++.dg/cpp0x/constexpr-template11.C: New.
2017-11-06 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/82838
......
// PR c++/65579
// { dg-do link { target c++11 } }
template <typename>
struct S {
int i;
};
struct T {
static constexpr S<int> s = { 1 };
};
int main()
{
return T::s.i;
}
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