summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>2006-06-17 01:11:34 +0000
committermmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>2006-06-17 01:11:34 +0000
commit8f62cb302831484950d20fd726cd916f3d47ec58 (patch)
tree28e7fb3f20c1c3914005cd91aa051226755c2675
parent67bde9534858697829538615dd0562327b568cc8 (diff)
downloadppe42-gcc-8f62cb302831484950d20fd726cd916f3d47ec58.tar.gz
ppe42-gcc-8f62cb302831484950d20fd726cd916f3d47ec58.zip
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@114739 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/cp/ChangeLog4
-rw-r--r--gcc/cp/decl.c17
-rw-r--r--gcc/testsuite/ChangeLog3
-rw-r--r--gcc/testsuite/g++.dg/template/static26.C10
4 files changed, 26 insertions, 8 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 35001a03a47..2cbadcfd11f 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 7db989d82a5..c80111145bd 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);
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index b4cc183d964..fe2b7e8b398 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,8 @@
2006-06-16 Mark Mitchell <mark@codesourcery.com>
+ PR c++/28016
+ * g++.dg/template/static26.C: New test.
+
PR c++/27979
* g++.dg/expr/bitfield2.C: New test.
diff --git a/gcc/testsuite/g++.dg/template/static26.C b/gcc/testsuite/g++.dg/template/static26.C
new file mode 100644
index 00000000000..095248bace4
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/static26.C
@@ -0,0 +1,10 @@
+// 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;
OpenPOWER on IntegriCloud