[Bug c++/92236] [concepts] Explain non-satisfaction in static_assert
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92236 --- Comment #7 from asutton at gcc dot gnu.org --- Author: asutton Date: Wed Nov 27 15:23:02 2019 New Revision: 278775 URL: https://gcc.gnu.org/viewcvs?rev=278775=gcc=rev Log: 2019-11-27 Andrew Sutton PR c++/92236 Defer evaluation of concept checks so that static assertions can emit more detailed diagnostics. gcc/cp/ * constexpr.c (cxx_eval_call_expression): Handle concept checks. (cxx_eval_constant_expression): Diagnose misuse of function concepts as template-id expressions. Follow the usual return path for results. (cxx_eval_outermost_constant_expr): Avoid calling cp_get_callee_fndecl_nofold for function concepts. * constraint.cc (build_function_check): Fully type the concept check so that we don't ICE in conversions. * cp-gimplify.c (cp_genericize_r) [CALL_EXPR]: Handle concept checks. [TEMPLATE_ID_EXPR] Likewise. * cvt.c (convert_to_void): Always evaluate concept checks so we don't accidentally ignore them. Substitution during satisfaction can make a program ill-formed (example in g++.dg/cpp2a/concepts6.C). * pt.c (tsubst_copy_and_build): [CALL_EXPR]: Don't evaluate concepts. [TEMPLATE_ID_EXPR]: Likewise. * semantics.c (finish_call_expr): Don't evaluate concepts. (finish_id_expression_1): Likewise. (finish_static_assert): Preserve the original condition so we can diagnose concept errors when a check returns false. gcc/testsuite/ * g++.dg/cpp2a/concepts-iconv1.C: Update diagnostics. * g++.dg/cpp2a/concepts-requires5.C: Likewise. * g++.dg/cpp2a/concepts6.C: New test. Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/constexpr.c trunk/gcc/cp/constraint.cc trunk/gcc/cp/cp-gimplify.c trunk/gcc/cp/cvt.c trunk/gcc/cp/pt.c trunk/gcc/cp/semantics.c trunk/gcc/testsuite/ChangeLog trunk/gcc/testsuite/g++.dg/cpp2a/concepts-iconv1.C trunk/gcc/testsuite/g++.dg/cpp2a/concepts-requires5.C
[Bug c++/92439] [concepts] trunk crashes on constraint satisfaction failure
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92439 --- Comment #3 from asutton at gcc dot gnu.org --- Author: asutton Date: Wed Nov 27 15:16:37 2019 New Revision: 278774 URL: https://gcc.gnu.org/viewcvs?rev=278774=gcc=rev Log: 2019-11-27 Andrew Sutton PR c++/92439 Improve quality of diagnostics for subexpressions that need parens. gcc/cp/ * parser.c (cp_parser_requires_clause_opt): Add a flag to indicate when parsing a requires-clause before lambda parameters, and... (cp_parser_lambda_declarator_opt): ... use that here ... (cp_parser_type_parameter): ... and here ... (cp_parser_late_return_type_opt): ... and here ... (cp_parser_explicit_template_declaration): ... and here. (cp_parser_diagnose_ungrouped_constraint_plain): Adjust the message because this can apply to subexpressions that are not immediately after a requires-clause. (cp_parser_diagnose_ungrouped_constraint_rich): Likewise. (primary_constraint_error): New. (cp_parser_constraint_requires_parens): New. (cp_parser_unary_constraint_requires_parens): New. (cp_parser_constraint_primary_expression): Check for unary expressions before parsing the primary expression. Also check for binary and postfix operators after a successful parse of the primary expression. Force a re-parse if the result would form a lower-precedence string. (cp_parser_constraint_logical_and_expression): Propagate lambda flag; move checks for ill-formed constraints into the constraint primary expression. (cp_parser_constraint_logical_or_expression): Likewise. (cp_parser_requires_clause_expression): Propagate lambda flag. gcc/testsuite/ * g++.dg/cpp2a/concepts-requires20.C: New. Added: trunk/gcc/testsuite/g++.dg/cpp2a/concepts-requires20.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/parser.c trunk/gcc/testsuite/ChangeLog
[Bug c++/88395] ICE: Segmentation fault signal terminated program cc1plus, with -std=c++2a -fconcepts
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88395 --- Comment #12 from asutton at gcc dot gnu.org --- Author: asutton Date: Wed Nov 27 15:09:22 2019 New Revision: 278773 URL: https://gcc.gnu.org/viewcvs?rev=278773=gcc=rev Log: 2019-11-27 Andrew Sutton PR c++/88395 Prevent recursive satisfaction by adding requests to the instantiation stack. gcc/cp/ * constraint.cc (satisfy_declaration_constraints): Push tinst levels around satisfaction. gcc/testsuite/ * g++.dg/cpp2a/concepts-pr88395.C: New. * g++.dg/cpp2a/concepts-recursive-sat1.C: New. * g++.dg/cpp2a/concepts-recursive-sat2.C: New. * g++.dg/cpp2a/concepts-recursive-sat3.C: New. Added: trunk/gcc/testsuite/g++.dg/cpp2a/concepts-pr88395.C trunk/gcc/testsuite/g++.dg/cpp2a/concepts-recursive-sat1.C trunk/gcc/testsuite/g++.dg/cpp2a/concepts-recursive-sat2.C trunk/gcc/testsuite/g++.dg/cpp2a/concepts-recursive-sat3.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/constraint.cc trunk/gcc/testsuite/ChangeLog
[Bug c++/89913] [8/9/10 Regression] ICE with invalid using declaration
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89913 --- Comment #5 from asutton at gcc dot gnu.org --- Author: asutton Date: Tue Nov 19 15:26:16 2019 New Revision: 278451 URL: https://gcc.gnu.org/viewcvs?rev=278451=gcc=rev Log: PR c++/89913 gcc/cp/ * pt.c (get_underlying_template): Exit loop if the original type of the alias is null. gcc/testsuite/ * g++.dg/cpp2a/pr89913.C: New test. Added: trunk/gcc/testsuite/g++.dg/cpp2a/pr89913.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/pt.c trunk/gcc/testsuite/ChangeLog
[Bug c++/92078] error: 'struct std::ptr' redeclared with different access
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92078 --- Comment #4 from asutton at gcc dot gnu.org --- Author: asutton Date: Tue Nov 19 15:18:50 2019 New Revision: 278450 URL: https://gcc.gnu.org/viewcvs?rev=278450=gcc=rev Log: PR c++/92078 gcc/cp/ * pt.c (maybe_new_partial_specialization): Apply access to newly created partial specializations. Update comment style. gcc/testsuite/ * g++.dg/cpp2a/concepts-pr92078.C: New. * g++.dg/cpp2a/concepts-requires18.C: Update diagnostics. Added: trunk/gcc/testsuite/g++.dg/cpp2a/concepts-pr92078.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/pt.c trunk/gcc/testsuite/ChangeLog trunk/gcc/testsuite/g++.dg/cpp2a/concepts-requires18.C