aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>2006-06-17 01:11:34 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>2006-06-17 01:11:34 +0000
commitda71e18caeb8bcc6c85c7785c137ee0f99516fb4 (patch)
tree28e7fb3f20c1c3914005cd91aa051226755c2675 /gcc/cp
parent18defd42d7eb850af6646a270a4753b9d5f18aaf (diff)
downloadgcc-da71e18caeb8bcc6c85c7785c137ee0f99516fb4.zip
gcc-da71e18caeb8bcc6c85c7785c137ee0f99516fb4.tar.gz
gcc-da71e18caeb8bcc6c85c7785c137ee0f99516fb4.tar.bz2
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
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog4
-rw-r--r--gcc/cp/decl.c17
2 files changed, 13 insertions, 8 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 35001a0..2cbadcf 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,9 @@
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
* call.c (standard_conversion): Strip cv-qualifiers from bitfield
types.
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 7db989d..c801111 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -5207,16 +5207,17 @@ cp_finish_decl (tree decl, tree init, bool init_const_expr_p,
if (at_function_scope_p ())
add_decl_expr (decl);
- if (TREE_CODE (decl) == VAR_DECL)
- layout_var_decl (decl);
-
- /* Output the assembler code and/or RTL code for variables and functions,
- unless the type is an undefined structure or union.
- If not, it will get done when the type is completed. */
- if (TREE_CODE (decl) == VAR_DECL || TREE_CODE (decl) == FUNCTION_DECL)
+ /* Let the middle end know about variables and functions -- but not
+ static data members in uninstantiated class templates. */
+ if (!saved_processing_template_decl
+ && (TREE_CODE (decl) == VAR_DECL
+ || TREE_CODE (decl) == FUNCTION_DECL))
{
if (TREE_CODE (decl) == VAR_DECL)
- maybe_commonize_var (decl);
+ {
+ layout_var_decl (decl);
+ maybe_commonize_var (decl);
+ }
make_rtl_for_nonlocal_decl (decl, init, asmspec);