summaryrefslogtreecommitdiffstats
path: root/clang/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-cxx03-extra-copy.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Fix clang's handling of the copy performed in the second phase of classRichard Smith2016-09-071-3/+3
| | | | | | | | | | | | | | | | | | | | | | | 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. llvm-svn: 280776
* Fix all tests under test/CXX (and test/Analysis) to pass if clang's defaultRichard Smith2016-08-311-1/+1
| | | | | | C++ language standard is not C++98. llvm-svn: 280309
* Change -Wbind-to-temporary-copy from an ExtWarn to an Extension.Nico Weber2014-09-181-1/+1
| | | | | | | | | | | | | | | | | The reasoning is that this construct is accepted by all compilers and valid in C++11, so it doesn't seem like a useful warning to have enabled by default. Building with -pedantic, -Wbind-to-temporary-copy, or -Wc++98-compat still shows the warning. The motivation is that I built re2, and this was the only warning that was emitted during the build. Both changing re2 to fix the warning and detecting clang and suppressing the warning in re2's build seem inferior than just giving the compiler a good default for this warning. Also move the cxx98compat version of this warning to CXX98CompatPedantic, and update tests accordingly. llvm-svn: 218008
* Improve the error message when a function overload candidate is rejectedKaelyn Uhrain2012-06-191-1/+1
| | | | | | | | | | | | | | | | | because it expects a reference and receives a non-l-value. For example, given: int foo(int &); template<int x> void b() { foo(x); } clang will now print "expects an l-value for 1st argument" instead of "no known conversion from 'int' to 'int &' for 1st argument". The change in wording (and associated code to detect the case) was prompted by comment #5 in PR3104, and should be the last bit of work needed for the bug. llvm-svn: 158691
* Modify how the -verify flag works. Currently, the verification string andRichard Trieu2011-12-151-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | diagnostic message are compared. If either is a substring of the other, then no error is given. This gives rise to an unexpected case: // expect-error{{candidate function has different number of parameters}} will match the following error messages from Clang: candidate function has different number of parameters (expected 1 but has 2) candidate function has different number of parameters It will also match these other error messages: candidate function function has different number of parameters number of parameters This patch will change so that the verification string must be a substring of the diagnostic message before accepting. Also, all the failing tests from this change have been corrected. Some stats from this cleanup: 87 - removed extra spaces around verification strings 70 - wording updates to diagnostics 40 - extra leading or trailing characters (typos, unmatched parens or quotes) 35 - diagnostic level was included (error:, warning:, or note:) 18 - flag name put in the warning (-Wprotocol) llvm-svn: 146619
* When performing initialization of a copy of a temporary object, useDouglas Gregor2010-11-121-1/+1
| | | | | | | direct-initialization (rather than copy-initialization) to initialize the temporary, allowing explicit constructors. Fixes PR8342. llvm-svn: 118880
* PR7245: Make binding a reference to a temporary without a usable copyJeffrey Yasskin2010-06-071-8/+24
| | | | | | constructor into an extension warning into the error that C++98 requires. llvm-svn: 105529
* When checking the copy constructor for the optional copy during aDouglas Gregor2010-04-181-3/+13
| | | | | | | | | reference binding to an rvalue of reference-compatible type, check parameters after the first for complete parameter types and build any required default function arguments. We're effectively simulating the type-checking for a call without building the call itself. llvm-svn: 101705
* In C++98/03, when binding a reference to an rvalue ofDouglas Gregor2010-04-181-0/+51
reference-compatible type, the implementation is permitted to make a copy of the rvalue (or many such copies, even). However, even though we don't make that copy, we are required to check for the presence of a suitable copy constructor. With this change, we do. Note that in C++0x we are not allowed to make these copies, so we test both dialects separately. Also note the FIXME in one of the C++03 tests, where we are not instantiating default function arguments for the copy constructor we pick (but do not call). The fix is obvious; eliminating the infinite recursion it causes is not. Will address that next. llvm-svn: 101704
OpenPOWER on IntegriCloud