class.c (resolve_address_of_overloaded_function): Don't emit an inform if the matching permerror returns false.

/cp
2018-07-16  Paolo Carlini  <paolo.carlini@oracle.com>

	* class.c (resolve_address_of_overloaded_function): Don't emit an
	inform if the matching permerror returns false.
	* pt.c (check_specialization_namespace): Likewise.

/testsuite
2018-07-16  Paolo Carlini  <paolo.carlini@oracle.com>

	* g++.dg/template/spec40.C: New.
	* g++.dg/parse/ptrmem8.C: Likewise.

From-SVN: r262740
This commit is contained in:
Paolo Carlini 2018-07-16 17:36:43 +00:00 committed by Paolo Carlini
parent 20b47be02c
commit 99422caabd
6 changed files with 46 additions and 7 deletions

View File

@ -1,3 +1,9 @@
2018-07-16 Paolo Carlini <paolo.carlini@oracle.com>
* class.c (resolve_address_of_overloaded_function): Don't emit an
inform if the matching permerror returns false.
* pt.c (check_specialization_namespace): Likewise.
2018-07-16 Jakub Jelinek <jakub@redhat.com> 2018-07-16 Jakub Jelinek <jakub@redhat.com>
PR c++/3698 PR c++/3698

View File

@ -7919,10 +7919,11 @@ resolve_address_of_overloaded_function (tree target_type,
if (!(complain & tf_error)) if (!(complain & tf_error))
return error_mark_node; return error_mark_node;
permerror (input_location, "assuming pointer to member %qD", fn); if (permerror (input_location, "assuming pointer to member %qD", fn)
if (!explained) && !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; explained = 1;
} }
} }

View File

@ -800,10 +800,10 @@ check_specialization_namespace (tree tmpl)
return true; return true;
else else
{ {
permerror (input_location, if (permerror (input_location,
"specialization of %qD in different namespace", tmpl); "specialization of %qD in different namespace", tmpl))
inform (DECL_SOURCE_LOCATION (tmpl), inform (DECL_SOURCE_LOCATION (tmpl),
" from definition of %q#D", tmpl); " from definition of %q#D", tmpl);
return false; return false;
} }
} }

View File

@ -1,3 +1,8 @@
2018-07-16 Paolo Carlini <paolo.carlini@oracle.com>
* g++.dg/template/spec40.C: New.
* g++.dg/parse/ptrmem8.C: Likewise.
2018-07-16 Ilya Leoshkevich <iii@linux.ibm.com> 2018-07-16 Ilya Leoshkevich <iii@linux.ibm.com>
* gcc.target/s390/mnop-mcount-m31-fpic.c: New testcase. * gcc.target/s390/mnop-mcount-m31-fpic.c: New testcase.

View File

@ -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>();
}

View File

@ -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() {}
}