diff options
author | Paolo Carlini <paolo@gcc.gnu.org> | 2015-11-05 16:47:40 +0000 |
---|---|---|
committer | Paolo Carlini <paolo@gcc.gnu.org> | 2015-11-05 16:47:40 +0000 |
commit | 7e4756e8438892aa362d846c83b91329a904e904 (patch) | |
tree | f650af3ebe02259fe837100de2ea8b3a787ea36e | |
parent | 451e8dae5dac91d6e3c4d835630d9a8fb4a52cc9 (diff) | |
download | gcc-7e4756e8438892aa362d846c83b91329a904e904.zip gcc-7e4756e8438892aa362d846c83b91329a904e904.tar.gz gcc-7e4756e8438892aa362d846c83b91329a904e904.tar.bz2 |
re PR c++/67846 (ICE on code with lambda expression on x86_64-linux-gnu in check_return_expr, at cp/typeck.c:8609)
/cp
2015-11-05 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/67846
* parser.c (cp_parser_lambda_body): Check lambda_return_type
return value.
* typeck2.c (cxx_incomplete_type_diagnostic): Print member or
member function used invalidly.
/testsuite
2015-11-05 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/67846
* g++.dg/cpp0x/lambda/lambda-ice15.C: New.
From-SVN: r229819
-rw-r--r-- | gcc/cp/ChangeLog | 12 | ||||
-rw-r--r-- | gcc/cp/parser.c | 7 | ||||
-rw-r--r-- | gcc/cp/typeck2.c | 8 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice15.C | 10 |
5 files changed, 35 insertions, 7 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 3312dae..57de3e6 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,11 @@ +2015-11-05 Paolo Carlini <paolo.carlini@oracle.com> + + PR c++/67846 + * parser.c (cp_parser_lambda_body): Check lambda_return_type + return value. + * typeck2.c (cxx_incomplete_type_diagnostic): Print member or + member function used invalidly. + 2015-11-05 Jakub Jelinek <jakub@redhat.com> Ilya Verbin <ilya.verbin@intel.com> @@ -27,8 +35,8 @@ cp_parser_require_pragma_eol instead of cp_parser_skip_to_pragma_eol. (cp_parser_omp_end_declare_target): Call cp_parser_require_pragma_eol instead of cp_parser_skip_to_pragma_eol. - * decl2.c (cplus_decl_attributes): Don't diagnose block scope vars inside - declare target. + * decl2.c (cplus_decl_attributes): Don't diagnose block scope vars + inside declare target. * pt.c (tsubst_omp_clauses): If OMP_CLAUSE_LINEAR_VARIABLE_STRIDE, use tsubst_omp_clause_decl instead of tsubst_expr on OMP_CLAUSE_LINEAR_STEP. Handle non-static data members in shared diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index f26c7c3..d439c06 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -9887,7 +9887,12 @@ cp_parser_lambda_body (cp_parser* parser, tree lambda_expr) if (cp_parser_parse_definitely (parser)) { if (!processing_template_decl) - apply_deduced_return_type (fco, lambda_return_type (expr)); + { + tree type = lambda_return_type (expr); + apply_deduced_return_type (fco, type); + if (type == error_mark_node) + expr = error_mark_node; + } /* Will get error here if type not deduced yet. */ finish_return_stmt (expr); diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c index 000f5e3..e73ea13 100644 --- a/gcc/cp/typeck2.c +++ b/gcc/cp/typeck2.c @@ -516,12 +516,12 @@ cxx_incomplete_type_diagnostic (const_tree value, const_tree type, 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 %<()%> ?)"); + "invalid use of member function %qD " + "(did you forget the %<()%> ?)", member); else emit_diagnostic (diag_kind, input_location, 0, - "invalid use of member " - "(did you forget the %<&%> ?)"); + "invalid use of member %qD " + "(did you forget the %<&%> ?)", member); } break; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 6cf2f4f..35bdfb0 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-11-05 Paolo Carlini <paolo.carlini@oracle.com> + + PR c++/67846 + * g++.dg/cpp0x/lambda/lambda-ice15.C: New. + 2015-11-05 Jakub Jelinek <jakub@redhat.com> * c-c++-common/gomp/clauses-2.c (foo): Adjust for diagnostics diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice15.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice15.C new file mode 100644 index 0000000..7c4c18d --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice15.C @@ -0,0 +1,10 @@ +// PR c++/67846 +// { dg-do compile { target c++11 } } + +class A +{ + void foo () + { + [=] { return foo; }; // { dg-error "invalid use of member function" } + } +}; |