diff options
author | Jason Merrill <jason@redhat.com> | 2017-03-15 17:32:43 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2017-03-15 17:32:43 -0400 |
commit | 559a77e112285e37f34e4ef2c1eec89771138c3b (patch) | |
tree | e1b26f69290cc351e612eb1e89d5a15f3e9a9c36 | |
parent | 3231d64b5e3e4e600f983acb7213bd9b39ddfad3 (diff) | |
download | gcc-559a77e112285e37f34e4ef2c1eec89771138c3b.zip gcc-559a77e112285e37f34e4ef2c1eec89771138c3b.tar.gz gcc-559a77e112285e37f34e4ef2c1eec89771138c3b.tar.bz2 |
PR c++/80043 - ICE with -fpermissive
* typeck.c (convert_for_assignment): Handle instantiate_type
not giving an error.
From-SVN: r246180
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/typeck.c | 7 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/parse/ptrmem7.C | 16 |
3 files changed, 28 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index aa74b00..e5fa93a 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2017-03-15 Jason Merrill <jason@redhat.com> + + PR c++/80043 - ICE with -fpermissive + * typeck.c (convert_for_assignment): Handle instantiate_type + not giving an error. + 2017-03-14 Nathan Sidwell <nathan@acm.org> PR c++/79393 DR 1658 workaround diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index d111124..4e9a1c0 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 0000000..37b2689 --- /dev/null +++ b/gcc/testsuite/g++.dg/parse/ptrmem7.C @@ -0,0 +1,16 @@ +// PR c++/80043 +// { dg-options -fpermissive } + +struct A +{ + template<int> void foo() + { + void (A::* fp)(); + fp = A::foo<0>; // { dg-warning "assuming pointer to member" } + } +}; + +void bar() +{ + A().foo<0>(); +} |