Commit da71e18c by Mark Mitchell Committed by Mark Mitchell

re PR c++/28016 (emitting template constant)

	PR c++/28016
	* decl.c (cp_finsh_decl): Do not emit uninstantiated static data
	members.
	PR c++/28016
	* g++.dg/template/static26.C: New test.

From-SVN: r114739
parent 18defd42
2006-06-16 Mark Mitchell <mark@codesourcery.com> 2006-06-16 Mark Mitchell <mark@codesourcery.com>
PR c++/28016
* decl.c (cp_finsh_decl): Do not emit uninstantiated static data
members.
PR c++/27979 PR c++/27979
* call.c (standard_conversion): Strip cv-qualifiers from bitfield * call.c (standard_conversion): Strip cv-qualifiers from bitfield
types. types.
......
...@@ -5207,16 +5207,17 @@ cp_finish_decl (tree decl, tree init, bool init_const_expr_p, ...@@ -5207,16 +5207,17 @@ cp_finish_decl (tree decl, tree init, bool init_const_expr_p,
if (at_function_scope_p ()) if (at_function_scope_p ())
add_decl_expr (decl); add_decl_expr (decl);
if (TREE_CODE (decl) == VAR_DECL) /* Let the middle end know about variables and functions -- but not
layout_var_decl (decl); static data members in uninstantiated class templates. */
if (!saved_processing_template_decl
/* Output the assembler code and/or RTL code for variables and functions, && (TREE_CODE (decl) == VAR_DECL
unless the type is an undefined structure or union. || TREE_CODE (decl) == FUNCTION_DECL))
If not, it will get done when the type is completed. */
if (TREE_CODE (decl) == VAR_DECL || TREE_CODE (decl) == FUNCTION_DECL)
{ {
if (TREE_CODE (decl) == VAR_DECL) if (TREE_CODE (decl) == VAR_DECL)
{
layout_var_decl (decl);
maybe_commonize_var (decl); maybe_commonize_var (decl);
}
make_rtl_for_nonlocal_decl (decl, init, asmspec); make_rtl_for_nonlocal_decl (decl, init, asmspec);
......
2006-06-16 Mark Mitchell <mark@codesourcery.com> 2006-06-16 Mark Mitchell <mark@codesourcery.com>
PR c++/28016
* g++.dg/template/static26.C: New test.
PR c++/27979 PR c++/27979
* g++.dg/expr/bitfield2.C: New test. * g++.dg/expr/bitfield2.C: New test.
// PR c++/28016
// { dg-final { scan-assembler-not "computed" } }
template<class T1, class T2>
struct scalar_divides_assign {
static const bool computed ;
};
template<class T1, class T2>
const bool scalar_divides_assign<T1,T2>::computed = true;
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