mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-19 05:16:53 +00:00

In `Sema::BuildStdInitializerList`, check that the synthesized template-id `std::initializer_list<T>` is valid (which might not be the case if the template has associated constraints or subsequent parameters with default arguments) before forming the type. Fixes #132256
19 lines
484 B
C++
19 lines
484 B
C++
// RUN: %clang_cc1 %s -verify -std=c++20
|
|
|
|
namespace std {
|
|
|
|
template<class T, class = T::x> // expected-error 2 {{type 'int' cannot be used prior to '::' because it has no members}}
|
|
class initializer_list;
|
|
|
|
}
|
|
|
|
namespace gh132256 {
|
|
|
|
auto x = {1}; // expected-note {{in instantiation of default argument for 'initializer_list<int>' required here}}
|
|
|
|
void f() {
|
|
for(int x : {1, 2}); // expected-note {{in instantiation of default argument for 'initializer_list<int>' required here}}
|
|
}
|
|
|
|
}
|