summaryrefslogtreecommitdiffstats
path: root/clang/test/CXX/over
Commit message (Collapse)AuthorAgeFilesLines
...
* Implement C++11 [over.match.copy]p1b2, which allows the use ofDouglas Gregor2012-02-241-0/+15
| | | | | | | | | | | explicit conversion functions to initialize the argument to a copy/move constructor that itself is the subject of direct initialization. Since we don't have that much context in overload resolution, we end up threading more flags :(. Fixes <rdar://problem/10903741> / PR10456. llvm-svn: 151409
* Modify how the -verify flag works. Currently, the verification string andRichard Trieu2011-12-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Add notes for suppressing and (if it's a zero-arg function returning bool) ↵David Blaikie2011-12-091-15/+15
| | | | | | fixing the function-to-bool conversion warning. llvm-svn: 146280
* Add a warning for implicit conversion from function literals (and staticLang Hames2011-12-051-14/+14
| | | | | | | | | | | | | methods) to bool. E.g. void foo() {} if (f) { ... // <- Warns here. } Only applies to non-weak functions, and does not apply if the function address is taken explicitly with the addr-of operator. llvm-svn: 145849
* Teach the ARC compiler to not require __bridge casts whenJohn McCall2011-10-171-2/+2
| | | | | | | passing/receiving CF objects at +0 to/from Objective-C methods or audited C functions. llvm-svn: 142219
* Update all tests other than Driver/std.cpp to use -std=c++11 rather thanRichard Smith2011-10-136-6/+6
| | | | | | -std=c++0x. Patch by Ahmed Charles! llvm-svn: 141900
* Catch placeholder types in DefaultLvalueConversionJohn McCall2011-10-111-15/+15
| | | | | | | | | | | and DefaultFunctionArrayLvalueConversion. To prevent significant regression for should-this-be-a-call fixits, and to repair some such regression from the introduction of bound member placeholders, make those placeholder checks try to build calls appropriately. Harden the build-a-call logic while we're at it. llvm-svn: 141738
* Always add the built-in overload candidates for operators &&, ||, andDouglas Gregor2011-10-101-0/+25
| | | | | | !. Fixes PR9865. llvm-svn: 141537
* Make yet another placeholder type, this one marking that an expression is a ↵John McCall2011-04-261-11/+12
| | | | | | | | | | | bound member function, i.e. something of the form 'x.f' where 'f' is a non-static member function. Diagnose this in the general case. Some of the new diagnostics are probably worse than the old ones, but we now get this right much more universally, and there's certainly room for improvement in the diagnostics. llvm-svn: 130239
* Simplify calling CheckPlaceholderExpr, converge on it in a few places,John McCall2011-04-101-6/+6
| | | | | | and move a vector-splat check to follow l-value conversion. llvm-svn: 129254
* Fix a bug in how we were resolving the address of overloaded functionsChandler Carruth2011-03-291-1/+65
| | | | | | | | | | | | | | | | | | | | | | | | when the resolution took place due to a single template specialization being named with an explicit template argument list. In this case, the "resolution" doesn't take into account the target type at all, and therefore can take place for functions, static member functions, and *non-static* member functions. The latter weren't being properly checked and their proper form enforced in this scenario. We now do so. The result of this last form slipping through was some confusing logic in IsStandardConversion handling of these resolved address-of expressions which eventually exploded in an assert. Simplify this logic a bit and add some more aggressive asserts to catch improperly formed expressions getting into this routine. Finally add systematic testing of member functions, both static and non-static, in the various forms they can take. One of these is essentially PR9563, and this commit fixes the crash in that PR. However, the diagnostics for this are still pretty terrible. We at least are now accepting the correct constructs and rejecting the invalid ones rather than accepting invalid or crashing as before. llvm-svn: 128456
* Produce a diagnostic for unused overloaded expressions, from Faisal Vali!Douglas Gregor2011-03-071-0/+31
| | | | llvm-svn: 127148
* Handle the resolution of a reference to a function template (whichDouglas Gregor2011-02-193-4/+97
| | | | | | | | includes explicitly-specified template arguments) to a function template specialization in cases where no deduction is performed or deduction fails. Patch by Faisal Vali, fixes PR7505! llvm-svn: 126048
* Implement the restriction that a function with a ref-qualifier cannotDouglas Gregor2011-01-261-4/+7
| | | | | | | | overload a function without a ref-qualifier (C++0x [over.load]p2). This, apparently, completes the implementation of rvalue references for *this. llvm-svn: 124321
* Rvalue references for *this: explicitly keep track of whether aDouglas Gregor2011-01-261-0/+5
| | | | | | | | | reference binding is for the implicit object parameter of a member function with a ref-qualifier. My previous comment, that we didn't need to track this explicitly, was wrong: we do in fact get rvalue-references-prefer-rvalues overloading with ref-qualifiers. llvm-svn: 124313
* Rvalue references for *this: implement the implicit conversion rulesDouglas Gregor2011-01-261-0/+65
| | | | | | | for the implicit object argument to a non-static member function with a ref-qualifier (C++0x [over.match.funcs]p4). llvm-svn: 124311
* Rvalue references for *this: allow functions to be overloaded based onDouglas Gregor2011-01-261-0/+21
| | | | | | | | | the presence and form of a ref-qualifier. Note that we do *not* yet implement the restriction in C++0x [over.load]p2 that requires either all non-static functions with a given parameter-type-list to have a ref-qualifier or none of them to have a ref-qualifier. llvm-svn: 124297
* Reinstate r124236 (tweaking the rvalue-reference overload resolutionDouglas Gregor2011-01-261-3/+3
| | | | | | rules), now that we've actually have a clean build for me to sully. llvm-svn: 124290
* Speculatively revert r124236Douglas Gregor2011-01-251-3/+3
| | | | llvm-svn: 124247
* Speculatively implement a tweak to the C++0x overload resolution rulesDouglas Gregor2011-01-251-3/+3
| | | | | | | | | | | | | | for reference binding (C++ [over.rank.ics]p3b1sb4), so that we prefer the binding of an lvalue reference to a function lvalue over the binding of an rvalue reference. This change resolves the ambiguity with std::forward and lvalue references to function types in a way that seems consistent with the original rvalue references proposal. My proposed wording for this change is shown in isBetterReferenceBindingKind(); we'll try to get this change adopted in the C++0x working paper as well. llvm-svn: 124236
* Fix the ranking of reference bindings during overload resolutionDouglas Gregor2011-01-251-1/+25
| | | | | | | | | | | | | | | | | | (C++0x [over.ics.rank]p3) when one binding is an lvalue reference and the other is an rvalue reference that binds to an rvalue. In particular, we were using the predict "is an rvalue reference" rather than "is an rvalue reference that binds to an rvalue", which was incorrect in the one case where an rvalue reference can bind to an lvalue: function references. This particular issue cropped up with std::forward, where Clang was picking an std::forward overload while forwarding an (lvalue) reference to a function. However (and unfortunately!), the right answer for this code is that the call to std::forward is ambiguous. Clang now gets that right, but we need to revisit the std::forward implementation in libc++. llvm-svn: 124216
* Add test for overload resolution's preference for binding an rvalueDouglas Gregor2011-01-211-0/+35
| | | | | | | reference to an rvalue rather than binding a const-qualified lvalue reference to that rvalue. llvm-svn: 123979
* Implement C++0x [temp.func.order]p3 (aka DR532) properly. InDouglas Gregor2010-11-151-16/+0
| | | | | | | | | | | | | particular, we only add the implement object parameter type if only one of the function templates is a non-static member function template. Moreover, since this DR differs from existing practice in C++98/03, this commit implements the existing practice (which ignores the first parameter of the function template that is not the non-static member function template) in C++98/03 mode. llvm-svn: 119145
* Implement C++ [over.match.funcs]p4 as it concerns partial ordering ofDouglas Gregor2010-11-121-0/+16
| | | | | | function templates. Fixes PR8130. llvm-svn: 118944
* Properly diagnose invalid casts to function references. Patch byDouglas Gregor2010-11-082-4/+2
| | | | | | Faisal Vali, tweaked by me. Fixes PR8230. llvm-svn: 118400
* Add builtin conditional operator candidates for scoped enumerationDouglas Gregor2010-10-151-0/+15
| | | | | | types, from Alp Toker! Fixes PR8344. llvm-svn: 116549
* Implement the "note" in C++ [over.built]p1, which is actually meant toDouglas Gregor2010-09-121-0/+16
| | | | | | | | be a semantic requirement that a built-in overloaded operator is not added to the overload set of there is already a user-defined overloaded operator with the same parameter types. Fixes PR8087. llvm-svn: 113713
* Implement C++ [over.ics.user]p3, which restricts the final conversionDouglas Gregor2010-04-121-0/+14
| | | | | | | | | from a conversion function template specialization to one of exact match rank. We only know how to test this in C++0x with default function template arguments, but it's also in the C++03 spec. Fixes PR6285. llvm-svn: 101089
* Initialization improvements: addition of string initialization and a fewEli Friedman2009-12-192-2/+2
| | | | | | | | small bug fixes in SemaInit, switch over SemaDecl to use it more often, and change a bunch of diagnostics which are different with the new initialization code. llvm-svn: 91767
* Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'.Daniel Dunbar2009-12-154-4/+4
| | | | | | | | | - This is designed to make it obvious that %clang_cc1 is a "test variable" which is substituted. It is '%clang_cc1' instead of '%clang -cc1' because it can be useful to redefine what gets run as 'clang -cc1' (for example, to set a default target). llvm-svn: 91446
* Update for LLVM API change.Owen Anderson2009-07-271-1/+1
| | | | llvm-svn: 77249
* Fix test case to match intent.Daniel Dunbar2009-07-111-1/+1
| | | | llvm-svn: 75381
* Another little test for C++ [over.over]Douglas Gregor2009-07-091-0/+10
| | | | llvm-svn: 75151
* Add test for C++ [over.over.]p1, the contexts in which one can take the ↵Douglas Gregor2009-07-091-0/+94
| | | | | | address of an overloaded function. llvm-svn: 75146
* Implement the simple form of overload resolution used when taking theDouglas Gregor2009-07-081-0/+23
| | | | | | | address of an overloaded function (which may involve both functions and function templates). llvm-svn: 75069
* Overload resolution prefers non-templates to templatesDouglas Gregor2009-07-071-0/+16
llvm-svn: 74971
OpenPOWER on IntegriCloud