https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96444
Patrick Palka <ppalka at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |FIXED Status|ASSIGNED |RESOLVED --- Comment #2 from Patrick Palka <ppalka at gcc dot gnu.org> --- Note that the testcase in comment #0 can be simplified by making the constraint not depend on T: template<typename T, typename U> concept Same = __is_same(T, U); template<typename T> void foo() { Same<bool> auto x = 0; } void bar() { foo<bool>(); } and yet we still accepted this invalid testcase. The reason for this is that during do_auto_deduction at template parse time, since the initializer is non-dependent we survived do_auto_deduction's early exit test and proceeded with deduction. And since do_auto_deduction also ignores constraints when processing_template_decl != 0, the overall deduction ended up succeeding and we destructively resolved the placeholder variable type to 'int' at parse time without ever checking the constraint. Anyway, this is fixed for GCC 11 by r11-7454, which made do_auto_deduction give up on deduction of a constrained placeholder type when processing_template_decl, so that we can retry the deduction at instantiation time instead.