]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/49440 (Invalid dynamic_cast for unnamed namespace)
authorJason Merrill <jason@redhat.com>
Mon, 27 Jun 2011 01:13:33 +0000 (21:13 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Mon, 27 Jun 2011 01:13:33 +0000 (21:13 -0400)
PR c++/49440
* class.c (set_linkage_according_to_type): Hand off to
determine_visibility.

From-SVN: r175418

gcc/cp/ChangeLog
gcc/cp/class.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/rtti/anon-ns1.C [new file with mode: 0644]

index 01332373acaec29f2682919e08da3fe72e34c98b..69dcf301052f0dd4e254de1af716217fea48b6e8 100644 (file)
@@ -1,3 +1,9 @@
+2011-06-23  Jason Merrill  <jason@redhat.com>
+
+       PR c++/49440
+       * class.c (set_linkage_according_to_type): Hand off to
+       determine_visibility.
+
 2011-05-31  Duncan Sands  <baldrick@free.fr>
 
        Backported from 4.6 branch
index 1bab07dd42c652552b25202d5eef7cc6f2500e9c..e98e5b20ab6419fc44f0cbb859cb7795d79c6554 100644 (file)
@@ -681,21 +681,10 @@ get_vtable_name (tree type)
    the abstract.  */
 
 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.
index b4bf554c36a52d801f4a4d64ddd29d770321a19d..ee72cd1c06642c97d6bbf69648e82dae5032cc8a 100644 (file)
@@ -1,3 +1,8 @@
+2011-06-23  Jason Merrill  <jason@redhat.com>
+
+       PR c++/49440
+       * g++.dg/rtti/anon-ns1.C: New.
+
 2011-06-17  Hans-Peter Nilsson  <hp@axis.com>
 
        Backport from mainline
diff --git a/gcc/testsuite/g++.dg/rtti/anon-ns1.C b/gcc/testsuite/g++.dg/rtti/anon-ns1.C
new file mode 100644 (file)
index 0000000..fd6f8af
--- /dev/null
@@ -0,0 +1,15 @@
+// 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();
+}