https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118187
Bug ID: 118187 Summary: Constraints of template template parameter not checked for non-dependent arguments despite [temp.names]/8 Product: gcc Version: 15.0 Status: UNCONFIRMED Keywords: accepts-invalid Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: hstong at ca dot ibm.com Target Milestone: --- https://wg21.link/temp.names#8 specifies that when """ all _template-argument_s in the _simple-template-id_ are non-dependent ([temp.dep.temp]), the associated constraints ([temp.constr.decl]) of the constrained template shall be satisfied """ where the "constrained template" may be a template template parameter. Even when template is instantiated, GCC and Clang both fail to emit a diagnostic for a violation of this rule. EDG and MSVC both diagnose without needing an instantiation. See also: https://github.com/cplusplus/CWG/issues/658 Online compiler link: https://godbolt.org/z/fTzMnEPG8 ### SOURCE (<stdin>) template <typename T> concept C = false; template <typename> struct Q; template <template <C> class TT> struct A { TT<int> *p; }; A<Q> a; ### COMPILER INVOCATION g++ -fsyntax-only -std=c++20 -Wall -Wextra -Werror -pedantic-errors -xc++ - ### ACTUAL COMPILER OUTPUT (clean compile) ### EXPECTED COMPILER OUTPUT (error) ### COMPILER VERSION INFO (g++ -v) Using built-in specs. COLLECT_GCC=/opt/wandbox/gcc-head/bin/g++ COLLECT_LTO_WRAPPER=/opt/wandbox/gcc-head/libexec/gcc/x86_64-pc-linux-gnu/15.0.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: ../source/configure --prefix=/opt/wandbox/gcc-head --enable-languages=c,c++ --disable-multilib --without-ppl --without-cloog-ppl --enable-checking=release --disable-nls --enable-lto LDFLAGS=-Wl,-rpath,/opt/wandbox/gcc-head/lib,-rpath,/opt/wandbox/gcc-head/lib64,-rpath,/opt/wandbox/gcc-head/lib32 Thread model: posix Supported LTO compression algorithms: zlib zstd gcc version 15.0.0 20241222 (experimental) (GCC)