Hi,
a very minor ICE on invalid regression, but since we explicitly allow
for redeclarations (also see comments in declare_global_var) we may as
well avoid crashing, at least in mainline. Tested x86_64-linux.
Thanks,
Paolo.
/////////////////
/cp
2014-01-29 Paolo Carlini <paolo.carl...@oracle.com>
PR c++/58846
* decl.c (get_dso_handle_node): Don't crash if dso_handle_node
== error_mark_node.
/testsuite
2014-01-29 Paolo Carlini <paolo.carl...@oracle.com>
PR c++/58846
* g++.dg/init/dso_handle2.C: New.
Index: cp/decl.c
===================================================================
--- cp/decl.c (revision 207234)
+++ cp/decl.c (working copy)
@@ -6709,8 +6709,11 @@ get_dso_handle_node (void)
ptr_type_node);
#ifdef HAVE_GAS_HIDDEN
- DECL_VISIBILITY (dso_handle_node) = VISIBILITY_HIDDEN;
- DECL_VISIBILITY_SPECIFIED (dso_handle_node) = 1;
+ if (dso_handle_node != error_mark_node)
+ {
+ DECL_VISIBILITY (dso_handle_node) = VISIBILITY_HIDDEN;
+ DECL_VISIBILITY_SPECIFIED (dso_handle_node) = 1;
+ }
#endif
return dso_handle_node;
Index: testsuite/g++.dg/init/dso_handle2.C
===================================================================
--- testsuite/g++.dg/init/dso_handle2.C (revision 0)
+++ testsuite/g++.dg/init/dso_handle2.C (working copy)
@@ -0,0 +1,10 @@
+// PR c++/58846
+
+extern "C" { char* __dso_handle; }
+
+struct A
+{
+ ~A();
+};
+
+A a; // { dg-error "conflicting declaration" }