Open
Description
https://wg21.link/temp.names#8 specifies that when
all template-arguments 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: cplusplus/CWG#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
clang++ -fsyntax-only -std=c++20 -Wall -Wextra -Werror -pedantic-errors -xc++ -
ACTUAL COMPILER OUTPUT
(clean compile)
EXPECTED COMPILER OUTPUT
(error)
COMPILER VERSION INFO (clang++ -v
)
clang version 20.0.0git (https://github.com/llvm/llvm-project.git b84218526d364cb9fda23bfca164d25a7b03a641)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /opt/wandbox/clang-head/bin
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/13
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/14
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/14
Candidate multilib: .;@m64
Selected multilib: .;@m64