diff options
author | Jakub Jelinek <jakub@redhat.com> | 2011-12-07 21:46:38 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2011-12-07 21:46:38 +0100 |
commit | ff180d72d9b327acc96bfacf45af71dac5b04006 (patch) | |
tree | 43e6086b7c3691de31b9aac2ccc09d847b4b694f /gcc | |
parent | 6f8e335e64fdac2f205714e2ccda0df654f3cdb9 (diff) | |
download | gcc-ff180d72d9b327acc96bfacf45af71dac5b04006.zip gcc-ff180d72d9b327acc96bfacf45af71dac5b04006.tar.gz gcc-ff180d72d9b327acc96bfacf45af71dac5b04006.tar.bz2 |
re PR c++/51429 (ICE with invalid use of overloaded member function)
PR c++/51429
* typeck2.c (cxx_incomplete_type_diagnostic): Don't
ICE if TREE_OPERAND (value, 1) is overloaded.
* g++.dg/parse/error45.C: New test.
From-SVN: r182089
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/cp/typeck2.c | 23 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 3 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/parse/error45.C | 9 |
4 files changed, 30 insertions, 9 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 0224868..19bbfed 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2011-12-07 Jakub Jelinek <jakub@redhat.com> + PR c++/51429 + * typeck2.c (cxx_incomplete_type_diagnostic): Don't + ICE if TREE_OPERAND (value, 1) is overloaded. + PR c++/51229 * decl.c (reshape_init_class): Complain if d->cur->index is INTEGER_CST. diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c index 2db3248..4648e75 100644 --- a/gcc/cp/typeck2.c +++ b/gcc/cp/typeck2.c @@ -428,15 +428,20 @@ cxx_incomplete_type_diagnostic (const_tree value, const_tree type, case OFFSET_TYPE: bad_member: - if (DECL_FUNCTION_MEMBER_P (TREE_OPERAND (value, 1)) - && ! flag_ms_extensions) - emit_diagnostic (diag_kind, input_location, 0, - "invalid use of member function " - "(did you forget the %<()%> ?)"); - else - emit_diagnostic (diag_kind, input_location, 0, - "invalid use of member " - "(did you forget the %<&%> ?)"); + { + tree member = TREE_OPERAND (value, 1); + if (is_overloaded_fn (member)) + member = get_first_fn (member); + if (DECL_FUNCTION_MEMBER_P (member) + && ! flag_ms_extensions) + emit_diagnostic (diag_kind, input_location, 0, + "invalid use of member function " + "(did you forget the %<()%> ?)"); + else + emit_diagnostic (diag_kind, input_location, 0, + "invalid use of member " + "(did you forget the %<&%> ?)"); + } break; case TEMPLATE_TYPE_PARM: diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 9803f77..e95eb49 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2011-12-07 Jakub Jelinek <jakub@redhat.com> + PR c++/51429 + * g++.dg/parse/error45.C: New test. + PR c++/51229 * g++.dg/ext/desig3.C: New test. diff --git a/gcc/testsuite/g++.dg/parse/error45.C b/gcc/testsuite/g++.dg/parse/error45.C new file mode 100644 index 0000000..7df8b13 --- /dev/null +++ b/gcc/testsuite/g++.dg/parse/error45.C @@ -0,0 +1,9 @@ +// PR c++/51429 +// { dg-do compile } + +struct A +{ + void foo (double); + void foo (int); + A () { foo = 0; } // { dg-error "invalid use of member function" } +}; |