===================================================================
@@ -7919,10 +7919,11 @@ resolve_address_of_overloaded_function (tree targe
if (!(complain & tf_error))
return error_mark_node;
- permerror (input_location, "assuming pointer to member %qD", fn);
- if (!explained)
+ if (permerror (input_location, "assuming pointer to member %qD", fn)
+ && !explained)
{
- inform (input_location, "(a pointer to member can only be formed with %<&%E%>)", fn);
+ inform (input_location, "(a pointer to member can only be "
+ "formed with %<&%E%>)", fn);
explained = 1;
}
}
===================================================================
@@ -800,10 +800,10 @@ check_specialization_namespace (tree tmpl)
return true;
else
{
- permerror (input_location,
- "specialization of %qD in different namespace", tmpl);
- inform (DECL_SOURCE_LOCATION (tmpl),
- " from definition of %q#D", tmpl);
+ if (permerror (input_location,
+ "specialization of %qD in different namespace", tmpl))
+ inform (DECL_SOURCE_LOCATION (tmpl),
+ " from definition of %q#D", tmpl);
return false;
}
}
===================================================================
@@ -0,0 +1,12 @@
+// { dg-options "-fpermissive -w" }
+
+namespace N {
+ template <typename T>
+ struct S {
+ void f() {} // { dg-bogus "from definition" }
+ };
+}
+
+namespace K {
+ template <> void N::S<char>::f() {}
+}
===================================================================
@@ -0,0 +1,15 @@
+// { dg-options "-fpermissive -w" }
+
+struct A
+{
+ template<int> void foo()
+ {
+ void (A::* fp)();
+ fp = A::foo<0>; // { dg-bogus "pointer to member" }
+ }
+};
+
+void bar()
+{
+ A().foo<0>();
+}