Commit 012d5d25 by Jason Merrill Committed by Jason Merrill

re PR c++/49440 (Invalid dynamic_cast for unnamed namespace)

	PR c++/49440
	* class.c (set_linkage_according_to_type): Just check TREE_PUBLIC
	on the type's name.

From-SVN: r175340
parent ece62004
2011-06-23 Jason Merrill <jason@redhat.com> 2011-06-23 Jason Merrill <jason@redhat.com>
PR c++/49440
* class.c (set_linkage_according_to_type): Just check TREE_PUBLIC
on the type's name.
PR c++/49395 PR c++/49395
* init.c (build_zero_init_1): Strip cv-quals from scalar types. * init.c (build_zero_init_1): Strip cv-quals from scalar types.
......
...@@ -677,21 +677,10 @@ get_vtable_name (tree type) ...@@ -677,21 +677,10 @@ get_vtable_name (tree type)
the abstract. */ the abstract. */
void void
set_linkage_according_to_type (tree type, tree decl) set_linkage_according_to_type (tree type ATTRIBUTE_UNUSED, tree decl)
{ {
/* If TYPE involves a local class in a function with internal
linkage, then DECL should have internal linkage too. Other local
classes have no linkage -- but if their containing functions
have external linkage, it makes sense for DECL to have external
linkage too. That will allow template definitions to be merged,
for example. */
if (no_linkage_check (type, /*relaxed_p=*/true))
{
TREE_PUBLIC (decl) = 0;
DECL_INTERFACE_KNOWN (decl) = 1;
}
else
TREE_PUBLIC (decl) = 1; TREE_PUBLIC (decl) = 1;
determine_visibility (decl);
} }
/* Create a VAR_DECL for a primary or secondary vtable for CLASS_TYPE. /* Create a VAR_DECL for a primary or secondary vtable for CLASS_TYPE.
......
2011-06-23 Jason Merrill <jason@redhat.com> 2011-06-23 Jason Merrill <jason@redhat.com>
PR c++/49440
* g++.dg/rtti/anon-ns1.C: New.
PR c++/49395 PR c++/49395
* g++.dg/init/ref18.C: New. * g++.dg/init/ref18.C: New.
......
// PR c++/49440
// The typeinfo name for A should start with * so we compare
// it by address rather than contents.
// { dg-final { scan-assembler "\"\*N\[^\"\]+1AE\"" } }
namespace
{
class A { };
}
void f()
{
throw A();
}
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