diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-04-12 17:09:20 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-04-12 17:09:20 +0000 |
commit | b93b606759c41aff4e6c8ce8c4ccc2a681880f4f (patch) | |
tree | 25f3ba59f84b79f1d4f23041e7f8990ce9a8a010 /clang/test/SemaCXX/implicit-member-functions.cpp | |
parent | 08e774b7ef3641e8ca83a519e4e882beb43819b0 (diff) | |
download | bcm5719-llvm-b93b606759c41aff4e6c8ce8c4ccc2a681880f4f.tar.gz bcm5719-llvm-b93b606759c41aff4e6c8ce8c4ccc2a681880f4f.zip |
When creating the implicitly-declared special member functions, be
sure to introduce them into the current Scope (when we have one) in
addition to the DeclContext for the class, so that they can be found
by name lookup for inline members of the class. Fixes PR6570.
llvm-svn: 101047
Diffstat (limited to 'clang/test/SemaCXX/implicit-member-functions.cpp')
-rw-r--r-- | clang/test/SemaCXX/implicit-member-functions.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/implicit-member-functions.cpp b/clang/test/SemaCXX/implicit-member-functions.cpp index 40a61e47fd3..2112188ae67 100644 --- a/clang/test/SemaCXX/implicit-member-functions.cpp +++ b/clang/test/SemaCXX/implicit-member-functions.cpp @@ -12,3 +12,30 @@ C& C::operator=(const C&) { return *this; } // expected-error {{definition of im struct D { }; // expected-note {{previous implicit declaration is here}} D::~D() { } // expected-error {{definition of implicitly declared destructor}} +// Make sure that the special member functions are introduced for +// name-lookup purposes and overload with user-declared +// constructors and assignment operators. +namespace PR6570 { + class A { }; + + class B { + public: + B() {} + + B(const A& a) { + operator = (CONST); + operator = (a); + } + + B& operator = (const A& a) { + return *this; + } + + void f(const A &a) { + B b(a); + }; + + static const B CONST; + }; + +} |