
This is a first pass at implementing [P2841R7](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2025/p2841r7.pdf). The implementation is far from complete; however, I'm aiming to do that in chunks, to make our lives easier. In particular, this does not implement - Subsumption - Mangling - Satisfaction checking is minimal as we should focus on #141776 first (note that I'm currently very stuck) FTM, release notes, status page, etc, will be updated once the feature is more mature. Given the state of the feature, it is not yet allowed in older language modes. Of note: - Mismatches between template template arguments and template template parameters are a bit wonky. This is addressed by #130603 - We use `UnresolvedLookupExpr` to model template-id. While this is pre-existing, I have been wondering if we want to introduce a different OverloadExpr subclass for that. I did not make the change in this patch.
45 lines
1.9 KiB
C++
45 lines
1.9 KiB
C++
// RUN: %clang_cc1 -std=c++20 -verify -fsyntax-only %s
|
|
|
|
namespace a {
|
|
template <typename T>
|
|
concept C1 = true; // #C1
|
|
|
|
template <typename T>
|
|
auto V1 = true; // #V1
|
|
|
|
namespace b {
|
|
template <typename T>
|
|
concept C2 = true; // #C2
|
|
template <typename T>
|
|
auto V2 = true; // #V2
|
|
}
|
|
}
|
|
|
|
template <typename T>
|
|
concept C3 = true; // #C3
|
|
template <typename T>
|
|
auto V3 = true; // #V3
|
|
template <template <typename T> typename C>
|
|
constexpr bool test = true;
|
|
|
|
static_assert(test<a::C1>); // expected-error {{template argument does not refer to a class or alias template, or template template parameter}} \
|
|
// expected-note@#C1 {{here}}
|
|
static_assert(test<a::b::C2>); // expected-error {{template argument does not refer to a class or alias template, or template template parameter}} \
|
|
// expected-note@#C2 {{here}}
|
|
static_assert(test<C3>); // expected-error {{template argument does not refer to a class or alias template, or template template parameter}} \
|
|
// expected-note@#C3 {{here}}
|
|
|
|
static_assert(test<a::V1>); // expected-error {{template argument does not refer to a class or alias template, or template template parameter}} \
|
|
// expected-note@#V1 {{here}}
|
|
static_assert(test<a::b::V2>); // expected-error {{template argument does not refer to a class or alias template, or template template parameter}} \
|
|
// expected-note@#V2 {{here}}
|
|
static_assert(test<V3>); // expected-error {{template argument does not refer to a class or alias template, or template template parameter}} \
|
|
// expected-note@#V3 {{here}}
|
|
|
|
|
|
void f() {
|
|
C3 t1 = 0; // expected-error {{expected 'auto' or 'decltype(auto)' after concept name}}
|
|
a::C1 t2 = 0; // expected-error {{expected 'auto' or 'decltype(auto)' after concept name}}
|
|
a::b::C2 t3 = 0; // expected-error {{expected 'auto' or 'decltype(auto)' after concept name}}
|
|
}
|