summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/member-expr.cpp
Commit message (Collapse)AuthorAgeFilesLines
* revert r311839 (ongoing cwg discussion)Faisal Vali2017-08-291-22/+0
| | | | | | apologies. llvm-svn: 311975
* Pass the correct object argument when a member call to an 'unrelated' class ↵Faisal Vali2017-08-271-0/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | is made. Prior to this patch, clang would do the wrong thing here (see inline comments for pre-patch behavior): struct A { void bar(int) { } static void bar(double) { } void g(int*); static void g(char *); }; struct B { void f() { A::bar(3); // selects (double) ??!! A::g((int*)0); // Instead of no object argument, states conversion error?!! } }; The fix is as follows: When we detect that what appears to be an implicit member function call (A::bar) is actually a call to a member of a class (A) unrelated to the type (B) that contains the member function (B::f) from which the call is being made, don't treat it (A::bar) as an Implicit Member Call Expression. P.S. I wonder if there is an existing bug report related to this? (Surprisingly, a cursory search did not find one). llvm-svn: 311839
* [Lit Test] Updated 26 Lit tests to be C++11 compatible.Charles Li2015-11-111-2/+6
| | | | | | | Expected diagnostics have been expanded to vary by C++ dialect. RUN line has also been expanded to: default, C++98/03 and C++11. llvm-svn: 252785
* Unify warnings/errors from "maybe you meant" to "did you mean".Eric Christopher2015-04-021-4/+4
| | | | llvm-svn: 233981
* Revert "Don't require -re suffix on -verify directives with regexes."Alp Toker2013-12-141-2/+2
| | | | | | | | | | This patch was submitted to the list for review and didn't receive a LGTM. (In fact one explicit objection and one query were raised.) This reverts commit r197295. llvm-svn: 197299
* Don't require -re suffix on -verify directives with regexes.Hans Wennborg2013-12-141-2/+2
| | | | | | Differential Revision: http://llvm-reviews.chandlerc.com/D2392 llvm-svn: 197295
* Change semantics of regex expectations in the diagnostic verifierHans Wennborg2013-12-111-2/+2
| | | | | | | | | | | | | | | | | | | | | | | Previously, a line like // expected-error-re {{foo}} treats the entirety of foo as a regex. This is inconvenient when matching type names containing regex characters. For example, to match "void *(class test8::A::*)(void)" inside such a regex, one would have to type "void \*\(class test8::A::\*\)\(void\)". This patch changes the semantics of expected-error-re to only treat the parts of the directive wrapped in double curly braces as regexes. This avoids the escaping problem and leads to nicer patterns for those cases; see e.g. the change to test/Sema/format-strings-scanf.c. (The balanced search for closing }} of a directive also makes us handle the full directive in test\SemaCXX\constexpr-printing.cpp:41 and :53.) Differential Revision: http://llvm-reviews.chandlerc.com/D2388 llvm-svn: 197092
* Revert "Try to correct a mistyped "-" or ">" to "->" for some C++ cases."Kaelyn Uhrain2013-11-051-13/+0
| | | | | | | Revert this patch until cases of rejected valid code (e.g. identifiers that require ADL to be resolved properly) are fixed. llvm-svn: 194088
* Try to correct a mistyped "-" or ">" to "->" for some C++ cases.Kaelyn Uhrain2013-11-041-0/+13
| | | | | | | | | | | | Similar C code isn't caught as it seems to hit a different code path. Also, as the check is only done for record pointers, cases involving an overloaded operator-> are not handled either. Note that the reason this check is done in the parser instead of Sema is not related to having enough knowledge about the current state as it is about being able to fix up the parser's state to be able to recover and traverse the correct code paths. llvm-svn: 194002
* Fix the end sourcelocation of the call expression in a member access whenNick Lewycky2013-08-211-0/+10
| | | | | | recovering by adding empty parenthesis. Fixes PR16676! llvm-svn: 188920
* A few small cleanups to r187504. Thanks to dblaikie for the assist.Kaelyn Uhrain2013-07-311-0/+2
| | | | llvm-svn: 187521
* Improve the diagnostic experience, including adding recovery, forKaelyn Uhrain2013-07-311-6/+32
| | | | | | changing '->' to '.' when there is no operator-> defined for a class. llvm-svn: 187504
* Fix a typo in the diagnostic note added in r186342.Kaelyn Uhrain2013-07-151-2/+2
| | | | llvm-svn: 186348
* Move the "->" to "." fixit from r186128 into a separate note sinceKaelyn Uhrain2013-07-151-1/+15
| | | | | | | | recovery is not attempted with the fixit. Also move the associated test case from FixIt/fixit.cpp to SemaCXX/member-expr.cpp since the fixit is no longer automatically applied. llvm-svn: 186342
* Per [basic.lookup.classref]p3, in an expression of the form p->~type-name, theRichard Smith2012-11-151-0/+5
| | | | | | | | | | type-name is looked up in the context of the complete postfix-expression. Don't forget to pass the scope into this lookup when the type-name is a template-id; it might name an alias template which can't be found within the class itself. Bug spotted by Johannes Schaub on #llvm. llvm-svn: 168011
* Fix a QoI bug reported by a user.Matt Beaumont-Gay2012-04-211-0/+10
| | | | | | | | | | | Set the source location for the "member reference base type ... is not a structure or union" diag to point at the operator rather than the member name. If we're giving this diagnostic because of a typo'd '.' in place of a ';' at the end of a line, the caret previously pointed at the identifier on the following line, which isn't as helpful as it could be. Pointing the caret at the '.' makes it more obvious what the problem is. llvm-svn: 155267
* Convert SemaExprMember.cpp to pass a callback object to CorrectTypo,Kaelyn Uhrain2012-01-131-2/+2
| | | | | | | | | improving the typo correction results in certain situations. This is also the first typo correction callback conversion to affect an existing unit test. :) llvm-svn: 148140
* A few minor improvements to error recovery trying to access member of a ↵Eli Friedman2012-01-131-0/+10
| | | | | | function. In particular, this restores the cool error recovery for the example from http://blog.llvm.org/2010/04/amazing-feats-of-clang-error-recovery.html , which regressed a few months back. llvm-svn: 148089
* 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
* Implement Sema::isExprCallable.Matt Beaumont-Gay2011-05-041-3/+9
| | | | | | | | We can use this to produce nice diagnostics (and try to fixit-and-recover) in various cases where we might see "MyFunction" instead of "MyFunction()". The changes in SemaExpr are an example of how to use isExprCallable. llvm-svn: 130878
* Much to my surprise, OverloadExprs can also point to function template decls.Matt Beaumont-Gay2011-03-051-0/+5
| | | | llvm-svn: 127061
* Clean up the error recovery at the bottom of Sema::LookupMemberExpr. ThisMatt Beaumont-Gay2011-02-221-2/+8
| | | | | | | mostly just shuffles various possibilities for recovery into a more straightforward order, but also unifies a couple of diagnostics. llvm-svn: 126266
* Fix PR9025 and add a diagnostic (and sometimes a fixit) for an overloadedMatt Beaumont-Gay2011-02-171-0/+15
| | | | | | | function name used as the base of a member expression. Early feedback from Chandler Carruth, and code review from Nick Lewycky. llvm-svn: 125714
* Don't die when a member access refers to a non-class member via aDouglas Gregor2010-07-281-0/+14
| | | | | | qualified name. Fixes <rdar://problem/8231724>. llvm-svn: 109682
* When typo correction produces a result that is not of the kind we'reDouglas Gregor2010-06-291-0/+11
| | | | | | | looking for, reset the name within the LookupResult structure in addition to clearing out the results. Fixes PR7508. llvm-svn: 107197
* Fix a point of semantics with using declaration hiding: method templatesJohn McCall2010-06-161-0/+18
| | | | | | | | | | | | | | | | | introduced by using decls are hidden even if their template parameter lists or return types differ from the "overriding" declaration. Propagate using shadow declarations around more effectively when looking up template-ids. Reperform lookup for template-ids in member expressions so that access control is properly set up. Fix some number of latent bugs involving template-ids with totally invalid base types. You can only actually get these with a scope specifier, since otherwise the template-id won't parse as a template-id. Fixes PR7384. llvm-svn: 106093
* When name lookup finds a single declaration that was imported via aDouglas Gregor2010-04-251-0/+16
| | | | | | | | using declaration, look at its underlying declaration to determine the lookup result kind (e.g., overloaded, unresolved). Fixes at least one issue in Boost.Bimap. llvm-svn: 102317
* Improve the diagnostic when we find something we did not expect in aDouglas Gregor2010-04-251-3/+3
| | | | | | | member expression (p-> or x.), by showing the type we looked into and what we did actually find. llvm-svn: 102315
* Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'.Daniel Dunbar2009-12-151-1/+1
| | | | | | | | | - 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
* Fix IsProvablyNotDerivedFrom to always use record definitions when available.John McCall2009-12-011-0/+15
| | | | | | Gets clang-on-clang passing again. llvm-svn: 90270
* Rework the fix-it hint for code likeDouglas Gregor2009-11-061-2/+1
| | | | | | | | | | | get_origin->x where get_origin is actually a function and the user has forgotten the parentheses. Instead of giving a lame note for the fix-it, give a full-fledge error, early, then build the call expression to try to recover. llvm-svn: 86238
* Fix a crash with qualified member access into a non-type, from Sean Hunt!Douglas Gregor2009-10-171-0/+11
| | | | llvm-svn: 84370
* Use "()" instead of "(void)" when pretty-printing a parameter-less function ↵Argyrios Kyrtzidis2009-06-031-1/+1
| | | | | | type for C++. llvm-svn: 72747
* If the user is trying to apply the -> or . member reference operatorDouglas Gregor2009-03-271-0/+11
| | | | | | | to a function or function pointer, it's probably because the user forgot to put in parentheses () to call the function. llvm-svn: 67826
* Rename clang to clang-cc.Daniel Dunbar2009-03-241-1/+1
| | | | | | Tests and drivers updated, still need to shuffle dirs. llvm-svn: 67602
* Add test for contextual conversion to bool, and enable some FIXME'd testsDouglas Gregor2009-01-161-2/+2
| | | | llvm-svn: 62302
* Add support for member references (E1.E2, E1->E2) with C++ semantics,Douglas Gregor2008-12-201-0/+22
which can refer to static data members, enumerators, and member functions as well as to non-static data members. Implement correct lvalue computation for member references in C++. Compute the result type of non-static data members of reference type properly. llvm-svn: 61294
OpenPOWER on IntegriCloud