https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117772
Bug ID: 117772 Summary: constrained auto in decl-specifier accepted for function return type despite trailing-return-type Product: gcc Version: 14.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: ing.russomauro at gmail dot com Target Milestone: --- C++20 standard, in ยง9.3.3.5 [dcl.fct], p2 reads In a declaration T D where D has the form D1 .... trailing-return-type ..., T shall be the single type-specifier auto. .... Therefore, the following program should not be accepted: (see: https://godbolt.org/z/E35efdTjo) #include <concepts> template<typename T> concept Cni = !std::integral<T>; Cni auto foo() -> std::same_as<void> auto{}; std::same_as<void> auto bar() -> Cni auto{}; template<typename T> concept Ct = true; Ct auto baz() -> Ct auto{}; // clang rejects this, too int main(){} Indeed, clang 19 rejects it, even in case of same constraint name: "error: function with trailing return type must specify return type 'auto', not 'Ct auto'" However, MVSC v19 also accepts (not tried with higher warning settings). I see a similar bug being Bug 80273 (cv-qualification), but also likely only another case ('auto' twice) compared to Bug 100589. Please, check whether this is definitively a new bug or not.