Commit 4bff36d3 by Mark Mitchell Committed by Mark Mitchell

re PR c++/24277 (Boost causes ICE in build_c_cast, at cp/typeck.c:5231)

	PR c++/24277
	* pt.c (instantiate_decl): Call finish_static_data_member_decl for
	static data members.
	PR c++/24277
	* g++.dg/template/static20.C: New test.

From-SVN: r105228
parent eb2182e2
...@@ -11558,13 +11558,19 @@ instantiate_decl (tree d, int defer_ok, ...@@ -11558,13 +11558,19 @@ instantiate_decl (tree d, int defer_ok,
&& !DECL_INITIAL (d) && !DECL_INITIAL (d)
&& DECL_INITIAL (code_pattern)) && DECL_INITIAL (code_pattern))
{ {
tree ns = decl_namespace_context (d); tree ns;
tree init;
ns = decl_namespace_context (d);
push_nested_namespace (ns); push_nested_namespace (ns);
push_nested_class (DECL_CONTEXT (d)); push_nested_class (DECL_CONTEXT (d));
DECL_INITIAL (d) init = tsubst_expr (DECL_INITIAL (code_pattern),
= tsubst_expr (DECL_INITIAL (code_pattern), args,
args, tf_error | tf_warning, NULL_TREE);
tf_error | tf_warning, NULL_TREE); DECL_INITIAL (d) = NULL_TREE;
finish_static_data_member_decl (d, init,
/*asmspec_tree=*/NULL_TREE,
LOOKUP_ONLYCONVERTING);
pop_nested_class (); pop_nested_class ();
pop_nested_namespace (ns); pop_nested_namespace (ns);
} }
......
2005-10-10 Mark Mitchell <mark@codesourcery.com> 2005-10-10 Mark Mitchell <mark@codesourcery.com>
PR c++/24277
* g++.dg/template/static20.C: New test.
PR c++/24302 PR c++/24302
* g++.dg/warn/Wunused-12.C: New test. * g++.dg/warn/Wunused-12.C: New test.
// PR c++/24277
template< int Bits > struct uint_t {
typedef unsigned short fast;
};
template < int Bits > struct mask_uint_t {
typedef typename uint_t< Bits >::fast fast;
static const fast sig_bits = 1;
static const fast sig_bits_fast = fast(sig_bits);
};
template < int Bits> int checksum ( ) {
return 1 & mask_uint_t<Bits>::sig_bits_fast;
}
int i = checksum<1>();
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