if (DECL_MODULE_EXPORT_P (STRIP_TEMPLATE (newdecl))
&& !DECL_MODULE_EXPORT_P (not_tmpl))
{
- error ("conflicting exporting declaration %qD", newdecl);
- inform (olddecl_loc, "previous declaration %q#D here", olddecl);
+ auto_diagnostic_group d;
+ error ("conflicting exporting for declaration %qD", newdecl);
+ inform (olddecl_loc,
+ "previously declared here without exporting");
}
}
else if (DECL_MODULE_EXPORT_P (newdecl))
tree decl = TYPE_NAME (t);
if (!module_may_redeclare (decl))
{
+ auto_diagnostic_group d;
error ("cannot declare %qD in a different module", decl);
- inform (DECL_SOURCE_LOCATION (decl), "declared here");
+ inform (DECL_SOURCE_LOCATION (decl), "previously declared here");
return error_mark_node;
}
+ tree not_tmpl = STRIP_TEMPLATE (decl);
+ if (DECL_LANG_SPECIFIC (not_tmpl)
+ && DECL_MODULE_ATTACH_P (not_tmpl)
+ && !DECL_MODULE_EXPORT_P (not_tmpl)
+ && module_exporting_p ())
+ {
+ auto_diagnostic_group d;
+ error ("conflicting exporting for declaration %qD", decl);
+ inform (DECL_SOURCE_LOCATION (decl),
+ "previously declared here without exporting");
+ }
+
tree maybe_tmpl = decl;
if (CLASS_TYPE_P (t) && CLASSTYPE_IS_TEMPLATE (t))
maybe_tmpl = CLASSTYPE_TI_TEMPLATE (t);
// { dg-module-cmi !frob }
int x ();
-export int x (); // { dg-error "conflicting exporting declaration" }
+export int x (); // { dg-error "conflicting exporting for declaration" }
int y;
-export extern int y; // { dg-error "conflicting exporting declaration" }
+export extern int y; // { dg-error "conflicting exporting for declaration" }
typedef int z;
-export typedef int z; // { dg-error "conflicting exporting declaration" }
+export typedef int z; // { dg-error "conflicting exporting for declaration" }
template <typename T> int f (T);
-export template <typename T> int f (T); // { dg-error "conflicting exporting declaration" }
+export template <typename T> int f (T); // { dg-error "conflicting exporting for declaration" }
-// doesn't go via duplicate_decls so we miss this for now
class A;
-export class A; // { dg-error "conflicting exporting declaration" "" { xfail *-*-* } }
+export class A; // { dg-error "conflicting exporting for declaration" }
-// { dg-warning "due to errors" "" { target *-*-* } 0 }
+template <typename T> struct B;
+export template <typename T> struct B {}; // { dg-error "conflicting exporting for declaration" }
+
+// { dg-warning "due to errors" "" { target *-*-* } 0 }