mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-05-13 17:37:00 +00:00

dependent until it's been converted to match its parameter. The type of a non-type template parameter can in general affect whether the template argument is dependent. Note that this is not always possible. For template arguments that name static local variables in templates, the type of the template parameter affects whether the argument is dependent, so the query is imprecise until we know the parameter type. For example, in: template<typename T> void f() { static const int n = 5; typename T::template X<n> x; } ... we don't know whether 'n' is dependent until we know whether the corresponding template parameter is of type 'int' or 'const int&'.
28 lines
602 B
C++
28 lines
602 B
C++
// RUN: %clang_cc1 -std=c++2a -x c++ %s -verify
|
|
|
|
namespace use_after_instantiation {
|
|
template<int &R> struct A { static constexpr int &value = R; };
|
|
|
|
template<typename = void> auto S() {
|
|
static int s;
|
|
return A<s>{};
|
|
}
|
|
|
|
auto &s = decltype(S())::value;
|
|
|
|
// This is ill-formed, but it should not crash.
|
|
// FIXME: Right now, it does crash.
|
|
// expected-no-diagnostics
|
|
#if 0
|
|
template<typename = void> auto T() {
|
|
static int s;
|
|
struct A {
|
|
static constexpr int &value = s; // expected-error {{static}}
|
|
};
|
|
return A{};
|
|
}
|
|
|
|
auto &t = decltype(T())::value;
|
|
#endif
|
|
}
|