aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>2004-01-29 16:47:14 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>2004-01-29 16:47:14 +0000
commit4a5e0ed992ed75f1514c270f45282f28ddb7a4b9 (patch)
treef76fc0b0acf17859346dfc813e962f5b89138094 /gcc
parent8cfb19429fab4d72d1a9916b2243873e1c24db84 (diff)
downloadgcc-4a5e0ed992ed75f1514c270f45282f28ddb7a4b9.zip
gcc-4a5e0ed992ed75f1514c270f45282f28ddb7a4b9.tar.gz
gcc-4a5e0ed992ed75f1514c270f45282f28ddb7a4b9.tar.bz2
re PR c++/13883 (Assembler messages: symbol is already defined)
PR c++/13883 * mangle.c (write_encoding): Correct encoding of member template constructors. PR c++/13883 * g++.dg/template/ctor3.C: New test. From-SVN: r76868
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/mangle.c17
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/template/ctor3.C19
4 files changed, 44 insertions, 3 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 6ce445c..19e787e 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2004-01-29 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/13883
+ * mangle.c (write_encoding): Correct encoding of member template
+ constructors.
+
2004-01-28 Giovanni Bajo <giovannibajo@gcc.gnu.org>
* parser.c (cp_parser_template_id): Parse tentatively `[:' after a
diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c
index 6552fe3..70b022b 100644
--- a/gcc/cp/mangle.c
+++ b/gcc/cp/mangle.c
@@ -688,18 +688,29 @@ write_encoding (const tree decl)
if (TREE_CODE (decl) == FUNCTION_DECL)
{
tree fn_type;
+ tree d;
if (decl_is_template_id (decl, NULL))
- fn_type = get_mostly_instantiated_function_type (decl);
+ {
+ fn_type = get_mostly_instantiated_function_type (decl);
+ /* FN_TYPE will not have parameter types for in-charge or
+ VTT parameters. Therefore, we pass NULL_TREE to
+ write_bare_function_type -- otherwise, it will get
+ confused about which artificial parameters to skip. */
+ d = NULL_TREE;
+ }
else
- fn_type = TREE_TYPE (decl);
+ {
+ fn_type = TREE_TYPE (decl);
+ d = decl;
+ }
write_bare_function_type (fn_type,
(!DECL_CONSTRUCTOR_P (decl)
&& !DECL_DESTRUCTOR_P (decl)
&& !DECL_CONV_FN_P (decl)
&& decl_is_template_id (decl, NULL)),
- decl);
+ d);
}
}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 3833667..45e6186 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2004-01-29 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/13883
+ * g++.dg/template/ctor3.C: New test.
+
2004-01-29 Giovanni Bajo <giovannibajo@gcc.gnu.org>
* g++.dg/tc1: New directory.
diff --git a/gcc/testsuite/g++.dg/template/ctor3.C b/gcc/testsuite/g++.dg/template/ctor3.C
new file mode 100644
index 0000000..d3eb2c3
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/ctor3.C
@@ -0,0 +1,19 @@
+struct A {};
+struct B;
+
+template <class TP> struct X: virtual A {
+ template <class TP2> X(TP2* ptr) {}
+ template <class TP2> X(const X<TP2>) {}
+};
+
+struct Y : X<B> {
+ Y(A* a) : X<B>(a) {}
+};
+
+void func1(X<B>);
+
+void func2() {
+ A a;
+ Y y(&a);
+ func1(X<A>(&a));
+}