From: Jason Merrill Date: Wed, 15 Mar 2017 21:32:43 +0000 (-0400) Subject: PR c++/80043 - ICE with -fpermissive X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=559a77e112285e37f34e4ef2c1eec89771138c3b;p=gcc.git PR c++/80043 - ICE with -fpermissive * typeck.c (convert_for_assignment): Handle instantiate_type not giving an error. From-SVN: r246180 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index aa74b007628..e5fa93aefb3 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2017-03-15 Jason Merrill + + PR c++/80043 - ICE with -fpermissive + * typeck.c (convert_for_assignment): Handle instantiate_type + not giving an error. + 2017-03-14 Nathan Sidwell PR c++/79393 DR 1658 workaround diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index d1111248dc7..4e9a1c0b6e7 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -8486,7 +8486,12 @@ convert_for_assignment (tree type, tree rhs, overloaded function. Call instantiate_type to get error messages. */ if (rhstype == unknown_type_node) - instantiate_type (type, rhs, tf_warning_or_error); + { + tree r = instantiate_type (type, rhs, tf_warning_or_error); + /* -fpermissive might allow this. */ + if (!seen_error ()) + return r; + } else if (fndecl) error ("cannot convert %qT to %qT for argument %qP to %qD", rhstype, type, parmnum, fndecl); diff --git a/gcc/testsuite/g++.dg/parse/ptrmem7.C b/gcc/testsuite/g++.dg/parse/ptrmem7.C new file mode 100644 index 00000000000..37b26895e4b --- /dev/null +++ b/gcc/testsuite/g++.dg/parse/ptrmem7.C @@ -0,0 +1,16 @@ +// PR c++/80043 +// { dg-options -fpermissive } + +struct A +{ + template void foo() + { + void (A::* fp)(); + fp = A::foo<0>; // { dg-warning "assuming pointer to member" } + } +}; + +void bar() +{ + A().foo<0>(); +}