<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/121008>121008</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            Constraints of template template parameter not checked for non-dependent arguments despite [temp.names]/8
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            bug,
            c++20,
            clang:frontend,
            concepts,
            diverges-from:msvc,
            diverges-from:edg
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          hubert-reinterpretcast
      </td>
    </tr>
</table>

<pre>
    https://wg21.link/temp.names#8 specifies that when

> all [_template-argument_](https://eel.is/c++draft/temp.names#nt:template-argument)s in the [_simple-template-id_](https://eel.is/c++draft/temp.names#nt:simple-template-id) are non-dependent ([[temp.dep.temp]](https://eel.is/c++draft/temp.dep.temp)), the associated constraints ([[temp.constr.decl]](https://eel.is/c++draft/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>`)
```cpp
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
```
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJysVstu27wSfhp6M5AhUb7ICy8U2QoC_I3TxmnPrqDIscVTihRIykn69AeUbMe5tEBPf0CGJXLm-4ZzJXNO7jXikkyvyHQ1Yp2vjV3WXYXWRxal9mhbi54z50eVEc_L2vvWkTQntCS0fNzTZKyk_kFo6bFpx5o16AhNM3AtcrmT6MDXzMNjjZrEeXjSNTClgEyvvgcdxTxGzO67BrX_TqYrQrPXLIhqLB2hJSf0itArYdnOv2XUnqT5OzxCFw6kBl9jT-hk0yqMznJS_CXje0BCF8AsgjY6EtiiFqg9EJr1Tr7qIQS24_ASuP-U_qxLF_1T9IdjzhkumUcB3GjnLZPauze0w85YIFf_D_Olek8OZteTnxlRwMkT4OoQ5QrBMS_dTqIY4v9Yo8UhIJR-pEkohYY9B1X2And-aZllDXq04wFvfUDdp9eLiAwxd55p33sk-Oi6KIBpAYVieg-V8TXsmFTgDWAjPTAQku21cV5y2BkLDA7SKOal0cMxpQPbKQys69V1D_bp_msxYB2VER6lr03nQSMKqffA9IUp0uij0feIwJQzJM3hdQT20tddNeamCVFoVefCj9Cy-HZNaCmd60L2lbNpNkBttJI6xKBppUILfTm-hzWiMsqPjd0TWv4ktNxtf37S67vrIwyh6fDA_ebhS7HuU2cWk7RwXkhN0nX4oosgOouHh7ctic9FByQt_HOLoT5gGxTinBvNsfVQAElXsGPKIUmvBsaP9EJzcN523MPnjwUv3osgzRVzDrZHvqNuDmQelKHfKGQo1XCivCXpFQTU-eoMn5O0-Nx3pePS6XhvHVNsPt3d_LP-Aje3XzdFvr3Z3L4R5yG7hsqBaOeetWdPkdHqGSLnBUlXx7KiMUTfQnlE3_DJWxb-rTUWohZFyBUe9d8Ooid-wvudaXmxfcj_ebFw87C9e9j2IhlXyPQpP44RvNRd_-du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