mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-11-24 06:10:12 +00:00
062be331e2
Previously, any undeclared unqualified id starting a nested name specifier in a dependent context would have its lookup retried during template instantiation. Now we limit that retry hack to methods of a class with dependent bases. Free function templates in particular are no longer affected by this hack. Also, diagnose this as a Microsoft extension. This has the downside that template authors may see this warning *and* an error during instantiation time about this identifier. Fixing that will probably require formalizing some kind of "delayed" identifier, instead of our ad-hoc solutions of forming dependent AST nodes when lookup fails. Based on a patch by Kim Gräsman! Differential Revision: http://reviews.llvm.org/D4854 llvm-svn: 215683
56 lines
1.3 KiB
C++
56 lines
1.3 KiB
C++
// RUN: %clang_cc1 -fms-compatibility -fsyntax-only -verify %s
|
|
|
|
namespace basic {
|
|
struct C {
|
|
static void foo2() {}
|
|
};
|
|
template <typename T>
|
|
struct A {
|
|
typedef C D;
|
|
};
|
|
|
|
template <typename T>
|
|
struct B : A<T> {
|
|
void foo() {
|
|
D::foo2(); // expected-warning {{use of undeclared identifier 'D'; unqualified lookup into dependent bases of class template 'B' is a Microsoft extension}}
|
|
}
|
|
};
|
|
|
|
template struct B<int>; // Instantiation has no warnings.
|
|
}
|
|
|
|
namespace nested_nodep_base {
|
|
// There are limits to our hacks, MSVC accepts this, but we don't.
|
|
struct A {
|
|
struct D { static void foo2(); };
|
|
};
|
|
template <typename T>
|
|
struct B : T {
|
|
struct C {
|
|
void foo() {
|
|
D::foo2(); // expected-error {{use of undeclared identifier 'D'}}
|
|
}
|
|
};
|
|
};
|
|
|
|
template struct B<A>; // Instantiation has no warnings.
|
|
}
|
|
|
|
namespace nested_dep_base {
|
|
// We actually accept this because the inner class has a dependent base even
|
|
// though it isn't a template.
|
|
struct A {
|
|
struct D { static void foo2(); };
|
|
};
|
|
template <typename T>
|
|
struct B {
|
|
struct C : T {
|
|
void foo() {
|
|
D::foo2(); // expected-warning {{use of undeclared identifier 'D'; unqualified lookup into dependent bases of class template 'C' is a Microsoft extension}}
|
|
}
|
|
};
|
|
};
|
|
|
|
template struct B<A>; // Instantiation has no warnings.
|
|
}
|