and the thing we have has a scope specifier, and we're in a context that doesn't
allow declaring a qualified name, then the error is a malformed type, not a
missing type.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156856
91177308-0d34-0410-b5e6-
96231b3b80d8
}
}
- if (DSC != DSC_type_specifier && DSC != DSC_trailing) {
+ // Determine whether this identifier could plausibly be the name of something
+ // being declared (with a missign type).
+ if (DSC != DSC_type_specifier && DSC != DSC_trailing &&
+ (!SS || DSC == DSC_top_level || DSC == DSC_class)) {
// Look ahead to the next token to try to figure out what this declaration
// was supposed to be.
switch (NextToken().getKind()) {
typedef T type;
type f();
+
+ type g();
};
template<typename T>
template<typename T>
A<T>::type A<T>::f() { return type(); } // expected-error{{missing 'typename'}}
+
+template<typename T>
+void f(int, T::type) { } // expected-error{{missing 'typename'}}
+
+template<typename T>
+void f(int, T::type, int) { } // expected-error{{missing 'typename'}}
+
+// FIXME: We know which type specifier should have been specified here. Provide
+// a fix-it to add 'typename A<T>::type'
+template<typename T>
+A<T>::g() { } // expected-error{{requires a type specifier}}