https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95132

            Bug ID: 95132
           Summary: Concept checked after auto return type deduction
           Product: gcc
           Version: 10.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: bluescarni at gmail dot com
  Target Milestone: ---

It seems like in GCC's implementation of C++20 concepts, concept checking is
done after the instantiation of the body of a function with auto return type
deduction.

See the godbolt link, where the same snippet of code is being compiled with
GCC, clang and MSVC:

https://godbolt.org/z/CMzZyV

As you see, the first GCC error comes from the failure in the instantiation of
the body of function bar(), and only later GCC complains about the concept
check failure. The other two compilers don't produce any error from the
instantiation of bar().

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.

Reply via email to