Fix clang's handling of the copy performed in the second phase of class
copy-initialization. We previously got this wrong in a couple of ways: - we only looked for copy / move constructors and constructor templates for this copy, and thus would fail to copy in cases where doing so should use some other constructor (but see core issue 670), - we mishandled the special case for disabling user-defined conversions that blocks infinite recursion through repeated application of a copy constructor (applying it in slightly too many cases) -- though as far as I can tell, this does not ever actually affect the result of overload resolution, and - we misapplied the special-case rules for constructors taking a parameter whose type is a (reference to) the same class type by incorrectly assuming that only happens for copy/move constructors (it also happens for constructors instantiated from templates and those inherited from base classes). These changes should only affect strange corner cases (for instance, where the copy constructor exists but has a non-const-qualified parameter type), so for the most part it only causes us to produce more 'candidate' notes, but see the test changes for other cases whose behavior is affected. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@280776 91177308-0d34-0410-b5e6-96231b3b80d8
Showing
- lib/Sema/SemaInit.cpp 106 additions, 119 deletionslib/Sema/SemaInit.cpp
- test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-cxx03-extra-copy.cpp 3 additions, 3 deletions...XX/dcl.decl/dcl.init/dcl.init.ref/p5-cxx03-extra-copy.cpp
- test/CXX/drs/dr0xx.cpp 3 additions, 3 deletionstest/CXX/drs/dr0xx.cpp
- test/CXX/drs/dr1xx.cpp 1 addition, 1 deletiontest/CXX/drs/dr1xx.cpp
- test/CodeGenCXX/copy-constructor-elim-2.cpp 20 additions, 0 deletionstest/CodeGenCXX/copy-constructor-elim-2.cpp
- test/SemaCXX/conditional-expr.cpp 1 addition, 1 deletiontest/SemaCXX/conditional-expr.cpp
- test/SemaCXX/copy-initialization.cpp 10 additions, 1 deletiontest/SemaCXX/copy-initialization.cpp
- test/SemaCXX/cxx0x-initializer-constructor.cpp 4 additions, 1 deletiontest/SemaCXX/cxx0x-initializer-constructor.cpp
- test/SemaCXX/cxx11-inheriting-ctors.cpp 30 additions, 2 deletionstest/SemaCXX/cxx11-inheriting-ctors.cpp
- test/SemaCXX/cxx98-compat-flags.cpp 1 addition, 1 deletiontest/SemaCXX/cxx98-compat-flags.cpp
- test/SemaCXX/cxx98-compat-pedantic.cpp 1 addition, 1 deletiontest/SemaCXX/cxx98-compat-pedantic.cpp
Loading
Please register or sign in to comment