aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>2004-03-01 20:38:31 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>2004-03-01 20:38:31 +0000
commitab73670a29184764111d4cd87d71542ba646bb4d (patch)
tree6d70b983cc9faef35b3620a156d1fbf28cb537be
parente245bd81a7f00b326e92b716bb2a852acd9a7d1d (diff)
downloadgcc-ab73670a29184764111d4cd87d71542ba646bb4d.zip
gcc-ab73670a29184764111d4cd87d71542ba646bb4d.tar.gz
gcc-ab73670a29184764111d4cd87d71542ba646bb4d.tar.bz2
re PR c++/14324 (Multiple static definitions are not unique)
PR c++/14324 * lex.c (retrofit_lang_decl): Treat entities with no linkage as having C++ linkage for name-mangling purposes. PR c++/14260 * parser.c (cp_parser_direct_declarator): Recognize constructor declarators that use a template-id to name the class being constructed. PR c++/14337 * pt.c (tsubst_qualified_id): Handle dependent qualifying scopes. (tsubst_expr): Do not call tsubst_copy, even when processing_template_decl. PR c++/14324 * g++.dg/abi/mangle21.C: New test. PR c++/14260 * g++.dg/parse/constructor2.C: New test. PR c++/14337 * g++.dg/template/sfinae1.C: New test. From-SVN: r78720
-rw-r--r--gcc/cp/ChangeLog16
-rw-r--r--gcc/cp/lex.c3
-rw-r--r--gcc/cp/parser.c5
-rw-r--r--gcc/cp/pt.c6
-rw-r--r--gcc/testsuite/ChangeLog11
-rw-r--r--gcc/testsuite/g++.dg/abi/mangle21.C13
-rw-r--r--gcc/testsuite/g++.dg/parse/constructor2.C11
-rw-r--r--gcc/testsuite/g++.dg/template/sfinae1.C21
8 files changed, 80 insertions, 6 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index b9ef593..9c7d3d9 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,19 @@
+2004-03-01 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/14324
+ * lex.c (retrofit_lang_decl): Treat entities with no linkage as
+ having C++ linkage for name-mangling purposes.
+
+ PR c++/14260
+ * parser.c (cp_parser_direct_declarator): Recognize constructor
+ declarators that use a template-id to name the class being
+ constructed.
+
+ PR c++/14337
+ * pt.c (tsubst_qualified_id): Handle dependent qualifying scopes.
+ (tsubst_expr): Do not call tsubst_copy, even when
+ processing_template_decl.
+
2004-03-01 Jeff Law <law@redhat.com>
* init.c (build_vec_delete_1): Convert 2nd argument to NE_EXPR to
diff --git a/gcc/cp/lex.c b/gcc/cp/lex.c
index ab248a4..2239c76 100644
--- a/gcc/cp/lex.c
+++ b/gcc/cp/lex.c
@@ -726,7 +726,8 @@ retrofit_lang_decl (tree t)
ld->u.f.u3sel = TREE_CODE (t) == FUNCTION_DECL ? 1 : 0;
DECL_LANG_SPECIFIC (t) = ld;
- if (current_lang_name == lang_name_cplusplus)
+ if (current_lang_name == lang_name_cplusplus
+ || decl_linkage (t) == lk_none)
SET_DECL_LANGUAGE (t, lang_cplusplus);
else if (current_lang_name == lang_name_c)
SET_DECL_LANGUAGE (t, lang_c);
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index bc887f8..77b5795 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -10628,7 +10628,10 @@ cp_parser_direct_declarator (cp_parser* parser,
/* See if it names ctor, dtor or conv. */
if (TREE_CODE (unqualified_name) == BIT_NOT_EXPR
|| IDENTIFIER_TYPENAME_P (unqualified_name)
- || constructor_name_p (unqualified_name, class_type))
+ || constructor_name_p (unqualified_name, class_type)
+ || (TREE_CODE (unqualified_name) == TYPE_DECL
+ && same_type_p (TREE_TYPE (unqualified_name),
+ class_type)))
*ctor_dtor_or_conv_p = -1;
}
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 3fa2576..20056eb 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -7325,7 +7325,8 @@ tsubst_qualified_id (tree qualified_id, tree args,
else
expr = name;
- my_friendly_assert (!dependent_type_p (scope), 20030729);
+ if (dependent_type_p (scope))
+ return build_nt (SCOPE_REF, scope, expr);
if (!BASELINK_P (name) && !DECL_P (expr))
{
@@ -7738,9 +7739,6 @@ tsubst_expr (tree t, tree args, tsubst_flags_t complain, tree in_decl)
if (t == NULL_TREE || t == error_mark_node)
return t;
- if (processing_template_decl)
- return tsubst_copy (t, args, complain, in_decl);
-
if (!STATEMENT_CODE_P (TREE_CODE (t)))
return tsubst_copy_and_build (t, args, complain, in_decl,
/*function_p=*/false);
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index c6dbd88..459ff66 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,14 @@
+2004-03-01 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/14324
+ * g++.dg/abi/mangle21.C: New test.
+
+ PR c++/14260
+ * g++.dg/parse/constructor2.C: New test.
+
+ PR c++/14337
+ * g++.dg/template/sfinae1.C: New test.
+
2004-02-29 Mark Mitchell <mark@codesourcery.com>
PR c++/14267
diff --git a/gcc/testsuite/g++.dg/abi/mangle21.C b/gcc/testsuite/g++.dg/abi/mangle21.C
new file mode 100644
index 0000000..f457d60
--- /dev/null
+++ b/gcc/testsuite/g++.dg/abi/mangle21.C
@@ -0,0 +1,13 @@
+// PR c++/14324
+// { dg-do assemble }
+
+extern "C" {
+
+void fun1(void)
+{
+ do { static int xyz __attribute__((unused)) = 1; } while (0);
+ do { static int xyz __attribute__((unused)) = 2; } while (0);
+ do { static int xyz __attribute__((unused)) = 3; } while (0);
+}
+
+}
diff --git a/gcc/testsuite/g++.dg/parse/constructor2.C b/gcc/testsuite/g++.dg/parse/constructor2.C
new file mode 100644
index 0000000..e514e93
--- /dev/null
+++ b/gcc/testsuite/g++.dg/parse/constructor2.C
@@ -0,0 +1,11 @@
+// PR c++/14260
+
+template <class TClass>
+class T
+{
+public:
+ T(short,short f=0) {}
+ T<TClass>(int f) {}
+ T<TClass>(int f=0,const char* b=0) {}
+};
+
diff --git a/gcc/testsuite/g++.dg/template/sfinae1.C b/gcc/testsuite/g++.dg/template/sfinae1.C
new file mode 100644
index 0000000..47db411
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/sfinae1.C
@@ -0,0 +1,21 @@
+// PR c++/14337
+
+template <bool> struct Constraint;
+template <> struct Constraint<true> { typedef int Result; };
+
+template <typename T>
+struct IsInt { static const bool value = false; };
+
+template <>
+struct IsInt<int> { static const bool value = true; };
+
+template <typename T>
+typename Constraint<IsInt<T>::value>::Result foo(T);
+
+template <typename T>
+typename Constraint<!IsInt<T>::value>::Result foo(T);
+
+template <typename>
+void bar() {
+ foo(1);
+}