https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115030
Bug ID: 115030 Summary: Constrained auto variable declaration with partial specialization Product: gcc Version: 14.1.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: sska1377 at gmail dot com Target Milestone: --- Created attachment 58173 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=58173&action=edit the code This is a simple valid code that uses a constrained auto placeholder that is dependent on template parameters, in a partial specialization variable template. // report_1.cc template<typename T, typename U> concept TheConcept = __is_same(T, U); template <typename T> struct A { }; template <typename T> char v = 'a'; template<typename T> TheConcept<T> auto v<A<T>> = 'c'; int main() { v<A<char>>; return 0; } which fails with the following error: $ g++ report_1.cc --std=c++20 report_1.cc: In instantiation of 'auto [requires ::TheConcept<<placeholder>, T>] v<A<char> >': report_1.cc:15:3: required from here 15 | v<A<char>>; | ^~~~~~~~~~ report_1.cc:12:30: error: deduced initializer does not satisfy placeholder constraints 12 | TheConcept<T> auto v<A<T>> = 'c'; | ^~~ report_1.cc:12:30: note: constraints not satisfied report_1.cc:2:9: required for the satisfaction of 'TheConcept<auto [requires ::TheConcept<<placeholder>, T>], T>' [with auto [requires ::TheConcept<<placeholder>, T>] = char; T = A<char>] report_1.cc:2:22: note: 'char' is not the same as 'A<char>' 2 | concept TheConcept = __is_same(T, U); | ^~~~~~~~~~~~~~~ This has been tested using: $ g++ -v Using built-in specs. COLLECT_GCC=g++ COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-linux-gnu/14.1.1/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: /build/gcc/src/gcc/configure --enable-languages=ada,c,c++,d,fortran,go,lto,m2,objc,obj-c++,rust --enable-bootstrap --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=https://gitlab.archlinux.org/archlinux/packaging/packages/gcc/-/issues --with-build-config=bootstrap-lto --with-linker-hash-style=gnu --with-system-zlib --enable-__cxa_atexit --enable-cet=auto --enable-checking=release --enable-clocale=gnu --enable-default-pie --enable-default-ssp --enable-gnu-indirect-function --enable-gnu-unique-object --enable-libstdcxx-backtrace --enable-link-serialization=1 --enable-linker-build-id --enable-lto --enable-multilib --enable-plugin --enable-shared --enable-threads=posix --disable-libssp --disable-libstdcxx-pch --disable-werror Thread model: posix Supported LTO compression algorithms: zlib zstd gcc version 14.1.1 20240507 (GCC)