diff options
author | Francois Pichet <pichet2000@gmail.com> | 2011-05-23 03:43:44 +0000 |
---|---|---|
committer | Francois Pichet <pichet2000@gmail.com> | 2011-05-23 03:43:44 +0000 |
commit | efb1af9ae83fc28702b3b946fa05b3960f689d5c (patch) | |
tree | 65ba40b51909cb74660dee2b710d5dd316a082aa /clang/test/SemaCXX/MicrosoftExtensions.cpp | |
parent | bc90690b24bdbc7d6d2f795bb77038a6c14d6120 (diff) | |
download | bcm5719-llvm-efb1af9ae83fc28702b3b946fa05b3960f689d5c.tar.gz bcm5719-llvm-efb1af9ae83fc28702b3b946fa05b3960f689d5c.zip |
Emulate a MSVC bug where if during an using declaration name lookup, the declaration found is unaccessible (private) and that declaration was bring into scope via another using declaration whose target declaration is accessible (public) then no error is generated.
Example:
class A { public: int f(); };
class B : public A { private: using A::f; };
class C : public B { private: using B::f; };
Here, B::f is private so this should fail in Standard C++, but because B::f refers to A::f which is public MSVC accepts it.
This fixes 1 error when parsing MFC code with clang.
llvm-svn: 131896
Diffstat (limited to 'clang/test/SemaCXX/MicrosoftExtensions.cpp')
-rw-r--r-- | clang/test/SemaCXX/MicrosoftExtensions.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/MicrosoftExtensions.cpp b/clang/test/SemaCXX/MicrosoftExtensions.cpp index 88e39226708..3391e7afb00 100644 --- a/clang/test/SemaCXX/MicrosoftExtensions.cpp +++ b/clang/test/SemaCXX/MicrosoftExtensions.cpp @@ -197,3 +197,22 @@ void pointer_to_integral_type_conv(char* ptr) { ch = (char)ptr; sh = (short)ptr; } + +namespace ms_using_declaration_bug { + +class A { +public: + int f(); +}; + +class B : public A { +private: + using A::f; +}; + +class C : public B { +private: + using B::f; // expected-warning {{using declaration refers to inaccessible member 'ms_using_declaration_bug::B::f', which refers to accessible member 'ms_using_declaration_bug::A::f', accepted for Microsoft compatibility}} +}; + +}
\ No newline at end of file |