aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/rtti.c
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>2004-12-22 18:00:39 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>2004-12-22 18:00:39 +0000
commitdfb5c52315ecc5b6ebabf2d7cb3d3d69f35a378b (patch)
tree92d85ea737af3ab701ec3aa12c9d0ae5763ee5c1 /gcc/cp/rtti.c
parent606145e4e0e54d412059033a6261c53bf11d7b6d (diff)
downloadgcc-dfb5c52315ecc5b6ebabf2d7cb3d3d69f35a378b.zip
gcc-dfb5c52315ecc5b6ebabf2d7cb3d3d69f35a378b.tar.gz
gcc-dfb5c52315ecc5b6ebabf2d7cb3d3d69f35a378b.tar.bz2
re PR c++/18464 (error message about "non-lvalue in unary '&'" when using ?: operator)
PR c++/18464 * call.c (build_this): In templates, do not bother with build_unary_op. * typeck.c (unary_complex_lvalue): In a template, always refuse simplifications. PR c++/18492 * cp-gimplify.c (cp_genericize): Relax assertion. PR c++/11224 * cvt.c (convert_to_void): Warn about unused values. PR c++/18257 * rtti.c (emit_support_tinfos): On systems without weak symbols, emit the runtime library type-info objects as non-COMDAT. PR c++/18464 * g++.dg/template/cond5.C: New test. PR c++/18492 * g++.dg/inherit/thunk3.C: New test. PR c++/11224 * g++.dg/warn/Wunused-9.C: New test. From-SVN: r92491
Diffstat (limited to 'gcc/cp/rtti.c')
-rw-r--r--gcc/cp/rtti.c42
1 files changed, 26 insertions, 16 deletions
diff --git a/gcc/cp/rtti.c b/gcc/cp/rtti.c
index c113e1c..6c92d19 100644
--- a/gcc/cp/rtti.c
+++ b/gcc/cp/rtti.c
@@ -1345,22 +1345,32 @@ emit_support_tinfos (void)
for (ix = 0; fundamentals[ix]; ix++)
{
tree bltn = *fundamentals[ix];
- tree bltn_ptr = build_pointer_type (bltn);
- tree bltn_const_ptr = build_pointer_type
- (build_qualified_type (bltn, TYPE_QUAL_CONST));
- tree tinfo;
-
- tinfo = get_tinfo_decl (bltn);
- TREE_USED (tinfo) = 1;
- TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (tinfo)) = 1;
-
- tinfo = get_tinfo_decl (bltn_ptr);
- TREE_USED (tinfo) = 1;
- TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (tinfo)) = 1;
-
- tinfo = get_tinfo_decl (bltn_const_ptr);
- TREE_USED (tinfo) = 1;
- TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (tinfo)) = 1;
+ tree types[3] = {
+ bltn,
+ build_pointer_type (bltn),
+ build_pointer_type (build_qualified_type (bltn, TYPE_QUAL_CONST))
+ };
+ int i;
+
+ for (i = 0; i < 3; ++i)
+ {
+ tree tinfo;
+ tinfo = get_tinfo_decl (types[i]);
+ TREE_USED (tinfo) = 1;
+ mark_needed (tinfo);
+ /* The C++ ABI requires that these objects be COMDAT. But,
+ On systems without weak symbols, initialized COMDAT
+ objects are emitted with internal linkage. (See
+ comdat_linkage for details.) Since we want these objects
+ to have external linkage so that copies do not have to be
+ emitted in code outside the runtime library, we make them
+ non-COMDAT here. */
+ if (!flag_weak)
+ {
+ gcc_assert (TREE_PUBLIC (tinfo) && !DECL_COMDAT (tinfo));
+ DECL_INTERFACE_KNOWN (tinfo) = 1;
+ }
+ }
}
}