};
using TypeDependence = TypeDependenceScope::TypeDependence;
+struct TemplateArgumentDependenceScope {
+ enum TemplateArgumentDependence : uint8_t {
+ UnexpandedPack = 1,
+ Instantiation = 2,
+ Dependent = 4,
+
+ Error = 8,
+
+ DependentInstantiation = Dependent | Instantiation,
+ None = 0,
+ All = 15,
+ LLVM_MARK_AS_BITMASK_ENUM(/*LargestValue=*/Error)
+ };
+};
+using TemplateArgumentDependence =
+ TemplateArgumentDependenceScope ::TemplateArgumentDependence;
+
#define LLVM_COMMON_DEPENDENCE(NAME) \
struct NAME##Scope { \
enum NAME : uint8_t { \
LLVM_COMMON_DEPENDENCE(NestedNameSpecifierDependence)
LLVM_COMMON_DEPENDENCE(TemplateNameDependence)
-LLVM_COMMON_DEPENDENCE(TemplateArgumentDependence)
#undef LLVM_COMMON_DEPENDENCE
// A combined space of all dependence concepts for all node types.
Dependence(TemplateArgumentDependence D)
: V(translate(D, TADependence::UnexpandedPack, UnexpandedPack) |
- translate(D, TADependence::Instantiation, Instantiation) |
- translate(D, TADependence::Dependent, Dependent)) {}
+ translate(D, TADependence::Instantiation, Instantiation) |
+ translate(D, TADependence::Dependent, Dependent) |
+ translate(D, TADependence::Error, Error)) {}
Dependence(TemplateNameDependence D)
: V(translate(D, TNDependence::UnexpandedPack, UnexpandedPack) |
TemplateArgumentDependence templateArgument() const {
return translate(V, UnexpandedPack, TADependence::UnexpandedPack) |
translate(V, Instantiation, TADependence::Instantiation) |
- translate(V, Dependent, TADependence::Dependent);
+ translate(V, Dependent, TADependence::Dependent) |
+ translate(V, Error, TADependence::Error);
}
TemplateNameDependence templateName() const {
auto *TemplateArgs = reinterpret_cast<TemplateArgument *>(this + 1);
for (const TemplateArgument &Arg : Args) {
- // Update instantiation-dependent and variably-modified bits.
+ // Update instantiation-dependent, variably-modified, and error bits.
// If the canonical type exists and is non-dependent, the template
// specialization type can be non-dependent even if one of the type
// arguments is. Given:
// RUN: %clang_cc1 -frecovery-ast -verify %s
-bool Foo(int *); // expected-note {{candidate function not viable}} \
- // expected-note {{candidate function not viable}}
+bool Foo(int *); // expected-note 3{{candidate function not viable}}
template <typename T>
struct Crash : decltype(Foo(T())) { // expected-error {{no matching function for call to 'Foo'}}
};
void test2() { Crash2<int>(); } // expected-note {{in instantiation of template class 'Crash2<int>' requested here}}
+
+template <typename T>
+class Base {};
+template <typename T>
+struct Crash3 : Base<decltype(Foo(T()))> { // expected-error {{no matching function for call to 'Foo'}}
+ Crash3(){};
+};
+
+void test3() { Crash3<int>(); } // expected-note {{in instantiation of template class}}