[Bug c++/95132] Concept checked after auto return type deduction
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95132 Patrick Palka changed: What|Removed |Added Resolution|--- |FIXED Status|ASSIGNED|RESOLVED --- Comment #6 from Patrick Palka --- Fixed for GCC 10.3+, thanks for the bug report.
[Bug c++/95132] Concept checked after auto return type deduction
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95132 --- Comment #5 from CVS Commits --- The releases/gcc-10 branch has been updated by Patrick Palka : https://gcc.gnu.org/g:833b180f097e8bae44634e6a31e9c92d661af301 commit r10-8951-g833b180f097e8bae44634e6a31e9c92d661af301 Author: Patrick Palka Date: Wed Oct 28 11:47:26 2020 -0400 c++: Check constraints before instantiation from mark_used [PR95132] This makes mark_used check constraints of a function _before_ calling maybe_instantiate_decl, so that we don't try instantiating a function (as part of return type deduction) with unsatisfied constraints. gcc/cp/ChangeLog: PR c++/95132 * decl2.c (mark_used): Move up the constraints_satisfied_p check so that we check constraints before calling maybe_instantiate_decl. gcc/testsuite/ChangeLog: PR c++/95132 * g++.dg/cpp2a/concepts-fn7.C: New test. (cherry picked from commit 9ccc3495766116ea4ae8e4cd8129beca60e30445)
[Bug c++/95132] Concept checked after auto return type deduction
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95132 --- Comment #4 from CVS Commits --- The master branch has been updated by Patrick Palka : https://gcc.gnu.org/g:9ccc3495766116ea4ae8e4cd8129beca60e30445 commit r11-4488-g9ccc3495766116ea4ae8e4cd8129beca60e30445 Author: Patrick Palka Date: Wed Oct 28 11:47:26 2020 -0400 c++: Check constraints before instantiation from mark_used [PR95132] This makes mark_used check constraints of a function _before_ calling maybe_instantiate_decl, so that we don't try instantiating a function (as part of return type deduction) with unsatisfied constraints. gcc/cp/ChangeLog: PR c++/95132 * decl2.c (mark_used): Move up the constraints_satisfied_p check so that we check constraints before calling maybe_instantiate_decl. gcc/testsuite/ChangeLog: PR c++/95132 * g++.dg/cpp2a/concepts-fn7.C: New test.
[Bug c++/95132] Concept checked after auto return type deduction
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95132 Patrick Palka changed: What|Removed |Added Status|WAITING |ASSIGNED Assignee|unassigned at gcc dot gnu.org |ppalka at gcc dot gnu.org Target Milestone|--- |10.3 --- Comment #3 from Patrick Palka --- (In reply to Patrick Palka from comment #2) > (In reply to Francesco Biscani from comment #0) > > This is problematic because it means that another concept that would check > > whether or not bar() can be called with a specific argument type would fail > > with a hard compile time error, instead of marking the concept as not > > satisfied. > > Would you have a concrete testcase for this behavior? Ah, here's one: $ cat testcase.C template struct A { static auto f() requires false { return T::fail; } }; template constexpr int v = requires { A::f(); }; static_assert(!v); $ g++ -std=c++20 testcase.C testcase.C: In instantiation of ‘static auto A::f() requires false [with T = int]’: testcase.C: required from ‘constexpr const int v’ testcase.C: required from here testcase.C: error: ‘fail’ is not a member of ‘int’ 2 | static auto f() requires false { return T::fail; } | ^~~~ We wrongly issue a hard error for the reason you pointed out.
[Bug c++/95132] Concept checked after auto return type deduction
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95132 Patrick Palka changed: What|Removed |Added CC||ppalka at gcc dot gnu.org --- Comment #2 from Patrick Palka --- (In reply to Francesco Biscani from comment #0) > This is problematic because it means that another concept that would check > whether or not bar() can be called with a specific argument type would fail > with a hard compile time error, instead of marking the concept as not > satisfied. Would you have a concrete testcase for this behavior?
[Bug c++/95132] Concept checked after auto return type deduction
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95132 Jonathan Wakely changed: What|Removed |Added Ever confirmed|0 |1 Last reconfirmed||2020-05-14 Status|UNCONFIRMED |WAITING --- Comment #1 from Jonathan Wakely --- Please read https://gcc.gnu.org/bugs (as requested when creating a bug) and provide the missing information.