Commit 766053b3 by Jason Merrill Committed by Jason Merrill

name-lookup.c (get_anonymous_namespace_name): Never use get_file_function_name.

	* name-lookup.c (get_anonymous_namespace_name): Never use
	get_file_function_name.

From-SVN: r196851
parent c77f56bb
2013-03-20 Jason Merrill <jason@redhat.com>
* name-lookup.c (get_anonymous_namespace_name): Never use
get_file_function_name.
* pt.c (retrieve_specialization): Handle null tmpl argument.
PR c++/17232
......
......@@ -69,14 +69,12 @@ get_anonymous_namespace_name (void)
{
if (!anonymous_namespace_name)
{
/* The anonymous namespace has to have a unique name
if typeinfo objects are being compared by name. */
if (! flag_weak || ! SUPPORTS_ONE_ONLY)
anonymous_namespace_name = get_file_function_name ("N");
else
/* The demangler expects anonymous namespaces to be called
something starting with '_GLOBAL__N_'. */
anonymous_namespace_name = get_identifier ("_GLOBAL__N_1");
/* We used to use get_file_function_name here, but that isn't
necessary now that anonymous namespace typeinfos
are !TREE_PUBLIC, and thus compared by address. */
/* The demangler expects anonymous namespaces to be called
something starting with '_GLOBAL__N_'. */
anonymous_namespace_name = get_identifier ("_GLOBAL__N_1");
}
return anonymous_namespace_name;
}
......
// Test that the anonymous namespace isn't mangled with random characters,
// but also doesn't get mixed up with an anonymous namespace in another
// translation unit.
// { dg-do run }
// { dg-additional-sources "anon1a.cc" }
namespace {
struct A
{
virtual void f();
};
void A::f() { }
}
extern void g();
int main()
{
try {
try {
g();
} catch (A) { __builtin_abort(); }
} catch (...) { }
}
namespace {
struct A
{
virtual void f();
};
void A::f() { }
}
void g() { throw A(); }
// Test that the anonymous namespace isn't mangled with random characters,
// but also doesn't get mixed up with an anonymous namespace in another
// translation unit.
// { dg-final { scan-assembler "\\*N12_GLOBAL__N_11AE" } }
namespace {
struct A
{
virtual void f();
};
void A::f() { }
}
extern void g();
int main()
{
try {
try {
g();
} catch (A) { __builtin_abort(); }
} catch (...) { }
}
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