diff options
author | Francois Pichet <pichet2000@gmail.com> | 2011-11-17 03:44:24 +0000 |
---|---|---|
committer | Francois Pichet <pichet2000@gmail.com> | 2011-11-17 03:44:24 +0000 |
commit | 857f9d6e5eef4efe9a9df1fd22f20210eeac5fc6 (patch) | |
tree | 8fda448d28a28f4e21365236236a98c3a1b71d73 /clang/test/SemaTemplate/ms-lookup-template-base-classes.cpp | |
parent | 5acdf59ebc6839fc877604168eb96a76fdb51e77 (diff) | |
download | bcm5719-llvm-857f9d6e5eef4efe9a9df1fd22f20210eeac5fc6.tar.gz bcm5719-llvm-857f9d6e5eef4efe9a9df1fd22f20210eeac5fc6.zip |
In Microsoft mode, make "Unqualified lookup into dependent bases of class templates" works inside default argument instantiation.
This is a little bit tricky because during default argument instantiation the CurContext points to a CXXMethodDecl but we can't use the keyword this or have an implicit member call generated.
This fixes 2 errors when parsing MFC code with clang.
llvm-svn: 144881
Diffstat (limited to 'clang/test/SemaTemplate/ms-lookup-template-base-classes.cpp')
-rw-r--r-- | clang/test/SemaTemplate/ms-lookup-template-base-classes.cpp | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/clang/test/SemaTemplate/ms-lookup-template-base-classes.cpp b/clang/test/SemaTemplate/ms-lookup-template-base-classes.cpp index 149ec4f8e9a..cc5edf7997a 100644 --- a/clang/test/SemaTemplate/ms-lookup-template-base-classes.cpp +++ b/clang/test/SemaTemplate/ms-lookup-template-base-classes.cpp @@ -65,9 +65,36 @@ class B : public A<T> { public: static void z2(){ static_func(); // expected-warning {{use of identifier 'static_func' found via unqualified lookup into dependent bases of class templates is a Microsoft extension}} - func(); // expected-warning {{use of identifier 'func' found via unqualified lookup into dependent bases of class templates is a Microsoft extension}} expected-error {{call to non-static member function without an object argument}} + func(); // expected-warning {{use of identifier 'func' found via unqualified lookup into dependent bases of class templates is a Microsoft extension}} expected-error {{call to non-static member function without an object argument}} } }; template class B<int>; // expected-note {{requested here}} } + + + +namespace lookup_dependent_base_class_default_argument { + +template<class T> +class A { +public: + static int f1(); // expected-note {{must qualify identifier to find this declaration in dependent base class}} + int f2(); // expected-note {{must qualify identifier to find this declaration in dependent base class}} +}; + +template<class T> +class B : public A<T> { +public: + void g1(int p = f1());// expected-warning {{use of identifier 'f1' found via unqualified lookup into dependent bases of class templates is a Microsoft extension}} + void g2(int p = f2());// expected-warning {{use of identifier 'f2' found via unqualified lookup into dependent bases of class templates is a Microsoft extension}} expected-error {{call to non-static member function without an object argument}} +}; + +void foo() +{ + B<int> b; + b.g1(); // expected-note {{required here}} + b.g2(); // expected-note {{required here}} +} + +}
\ No newline at end of file |