Commit ab73670a by Mark Mitchell Committed by Mark Mitchell

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
parent e245bd81
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
......
......@@ -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);
......
......@@ -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;
}
......
......@@ -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);
......
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
......
// 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);
}
}
// 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) {}
};
// 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);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment