if (Context.hasSameUnqualifiedType(QualType(Ty, 1), Base->getType()))
return true;
}
- return false;
+ return CurContext->isFunctionOrMethod();
}
bool Sema::DiagnoseUnknownTypeName(const IdentifierInfo &II,
<< &II << DC << SS->getRange();
else if (isDependentScopeSpecifier(*SS)) {
unsigned DiagID = diag::err_typename_missing;
- if (getLangOptions().MicrosoftExt && isMicrosoftMissingTypename(SS))
+ if (getLangOptions().MicrosoftMode && isMicrosoftMissingTypename(SS))
DiagID = diag::warn_typename_missing;
Diag(SS->getRange().getBegin(), DiagID)
}\r
\r
\r
+namespace MissingTypename {\r
+\r
+template<class T> class A {\r
+public:\r
+ typedef int TYPE;\r
+};\r
+\r
+template<class T> class B {\r
+public:\r
+ typedef int TYPE;\r
+};\r
+\r
+\r
+template<class T, class U>\r
+class C : private A<T>, public B<U> {\r
+public:\r
+ typedef A<T> Base1;\r
+ typedef B<U> Base2;\r
+ typedef A<U> Base3;\r
+\r
+ A<T>::TYPE a1; // expected-warning {{missing 'typename' prior to dependent type name}}\r
+ Base1::TYPE a2; // expected-warning {{missing 'typename' prior to dependent type name}}\r
+\r
+ B<U>::TYPE a3; // expected-warning {{missing 'typename' prior to dependent type name}}\r
+ Base2::TYPE a4; // expected-warning {{missing 'typename' prior to dependent type name}}\r
+\r
+ A<U>::TYPE a5; // expected-error {{missing 'typename' prior to dependent type name}}\r
+ Base3::TYPE a6; // expected-error {{missing 'typename' prior to dependent type name}}\r
+ };\r
+\r
+class D {\r
+public:\r
+ typedef int Type;\r
+};\r
+\r
+template <class T>\r
+void function_missing_typename()\r
+{\r
+ const T::Type var = 2; // expected-warning {{missing 'typename' prior to dependent type name}}\r
+}\r
+\r
+template void function_missing_typename<D>();\r
+\r
+}\r
void BB<T>::f(int g = 0) { } // expected-warning {{redefinition of default argument}}
-namespace MissingTypename {
-
-template<class T> class A {
-public:
- typedef int TYPE;
-};
-
-template<class T> class B {
-public:
- typedef int TYPE;
-};
-
-
-template<class T, class U>
-class C : private A<T>, public B<U> {
-public:
- typedef A<T> Base1;
- typedef B<U> Base2;
- typedef A<U> Base3;
-
- A<T>::TYPE a1; // expected-warning {{missing 'typename' prior to dependent type name}}
- Base1::TYPE a2; // expected-warning {{missing 'typename' prior to dependent type name}}
-
- B<U>::TYPE a3; // expected-warning {{missing 'typename' prior to dependent type name}}
- Base2::TYPE a4; // expected-warning {{missing 'typename' prior to dependent type name}}
-
- A<U>::TYPE a5; // expected-error {{missing 'typename' prior to dependent type name}}
- Base3::TYPE a6; // expected-error {{missing 'typename' prior to dependent type name}}
- };
-
-}
-
-
-
extern void static_func();
void static_func(); // expected-note {{previous declaration is here}}