summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX
Commit message (Collapse)AuthorAgeFilesLines
* Improve our handling of user-defined conversions when computingDouglas Gregor2010-08-112-12/+50
| | | | | | | | | | | | | | | | | | | | | | implicit conversion sequences. In particular, model the "standard conversion" from a class to its own type (or a base type) directly as a standard conversion in the normal path *without* trying to determine if there is a valid copy constructor. This appears to match the intent of C++ [over.best.ics]p6 and more closely matches GCC and EDG. As part of this, model non-lvalue reference initialization via user-defined conversion in overloading the same way we handle it in InitializationSequence, separating the "general user-defined conversion" and "conversion to compatible class type" cases. The churn in the overload-call-copycon.cpp test case is because the test case was originally wrong; it assumed that we should do more checking for copy constructors that we actually should, which affected overload resolution. Fixes PR7055. Bootstrapped okay. llvm-svn: 110773
* When attempting to recover from a failed unqualified name lookup, makeDouglas Gregor2010-08-091-0/+6
| | | | | | sure to clear out the LookupResult structure after looking into each class. llvm-svn: 110615
* Fix a crash on template delete operators.Chandler Carruth2010-08-081-0/+12
| | | | llvm-svn: 110542
* Make this test check a few more cases which didn't work correctly beforeEli Friedman2010-08-081-1/+27
| | | | | | r110526. llvm-svn: 110540
* PR7800: both virtual and non-virtual bases must be marked as used for VTTs.Eli Friedman2010-08-071-0/+16
| | | | llvm-svn: 110526
* The pre-increment/pre-decrement grammar in C++ differs from that in C,Douglas Gregor2010-08-061-0/+5
| | | | | | | but we were parsing the C grammar. Handle the C++ grammar appropriately. Fixes PR7794. llvm-svn: 110445
* Introduce implicit conversions between AltiVec vectors and GCCDouglas Gregor2010-08-061-0/+18
| | | | | | vectors, from Anton Yartsev! llvm-svn: 110437
* PR7769: Fix references to anonymous structs/unions in base classes inEli Friedman2010-08-051-0/+13
| | | | | | offsetof expressions. llvm-svn: 110327
* Remove the warning for variables declared in the if-expression being used inNick Lewycky2010-08-051-45/+0
| | | | | | | | the else clause. The problem is that it's overly zealous and will respond to uses in assignments, or after assignments. We should bring this back once we can do it right. Fixes PR7100. llvm-svn: 110314
* Remove a redundant and broken check. Fixes PR7810.Sebastian Redl2010-08-051-0/+11
| | | | llvm-svn: 110294
* Emit standard-library RTTI with external linkage, not weak_odr.John McCall2010-08-041-1/+1
| | | | | | | | | | Apply hidden visibility to most RTTI; libstdc++ does not rely on exact pointer equality for the type info (just the type info names). Apply the same optimization to RTTI that we do to vtables. Fixes PR5962. llvm-svn: 110192
* Only look up an 'operator delete' on the definition of a destructor, not onJohn McCall2010-08-041-1/+1
| | | | | | a declaration. llvm-svn: 110175
* Labels (and case statement) don't create independent scope parents for theJohn McCall2010-08-021-0/+18
| | | | | | | | purposes of the jump checker. Also extend Ted's iteration fix to labels. Fixes PR7789. llvm-svn: 110082
* Further adjustments to -Wglobal-constructors; works for references and directJohn McCall2010-08-021-8/+11
| | | | | | initializations now. llvm-svn: 110063
* Kill off RequiresGlobalConstructor in favor of isConstantInitializer.John McCall2010-08-011-0/+16
| | | | | | Note some obvious false positives in the test case. llvm-svn: 109986
* Make a first pass at implementing -Wglobal-constructors. I'm worried that thisJohn McCall2010-08-011-0/+39
| | | | | | | will end up bizarrely mirroring CGExprConstant, but that might be the hazard of this feature. llvm-svn: 109984
* Don't consider all local variables in C++ to mandate scope-checking, justJohn McCall2010-08-011-0/+12
| | | | | | those with initializers. llvm-svn: 109964
* Fixed typedef inside extern "C".Abramo Bagnara2010-07-301-0/+3
| | | | llvm-svn: 109865
* When deleting a value of class type, make sure that type is completeDouglas Gregor2010-07-291-0/+11
| | | | | | before looking for conversions to pointer type. Fixes <rdar://problem/8248780>. llvm-svn: 109749
* 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
* Fix a minor crash bug with constructs like Obj.Class::ENUM_VALUE.Eli Friedman2010-07-271-0/+10
| | | | llvm-svn: 109537
* turn down the logical bitwise confusion warning to not warn Chris Lattner2010-07-241-2/+1
| | | | | | | | | when the RHS of the ||/&& is ever 0 or 1. This handles a variety of creative idioms for "true" used in C programs and fixes many false positives at the expense of a few false negatives. This fixes rdar://8230351. llvm-svn: 109314
* Fix for PR7694: make sure to pass in a RecordType to CheckBaseClassAccess;Eli Friedman2010-07-231-0/+11
| | | | | | | fixes crashes on both valid and invalid code. The diagnostic here could potentially be improved, but it's good enough as-is. llvm-svn: 109257
* Ted pointed out that this test case could be using access control instead ofJohn McCall2010-07-221-6/+5
| | | | | | | __attribute__((unavailable)). I've done so, but unfortunately there's still a case of redundant diagnostics. llvm-svn: 109192
* Upgrade "'X' is unavailable" from a warning to an error. This matches GCC's ↵Ted Kremenek2010-07-211-3/+3
| | | | | | | | | | | | behavior. Note that GCC emits a warning instead of an error when using an unavailable Objective-C protocol, so now Clang's behavior is more strict in this case, but more consistent. We will need to see how much this fires on real code and determine whether this case should be downgraded to a warning. Fixes <rdar://problem/8213093>. llvm-svn: 109033
* Make this grossness default to the error it should always be.Chandler Carruth2010-07-161-1/+1
| | | | llvm-svn: 108511
* Butcher a perfectly reasonable diagnostic to pacify old versions of SWIG.Chandler Carruth2010-07-161-1/+1
| | | | llvm-svn: 108505
* Make the "unused result" warning a warning about run-time behavior, soDouglas Gregor2010-07-151-1/+1
| | | | | | that we don't warn when there isn't going to be any computation anyway. llvm-svn: 108442
* Add test case for PR5290; this bug was fixed with the non-class rvalueDouglas Gregor2010-07-151-0/+18
| | | | | | de-cv-qualification fixes. llvm-svn: 108437
* Wire up '-Wignored-qualifiers' to the warning on 'const' in 'const int f()'.Chandler Carruth2010-07-144-5/+15
| | | | | | | | | This flag and warning match GCC semantics. Also, move it to -Wextra as this is a largely cosmetic issue and doesn't seem to mask problems. Subsequent fixes to the tests which no longer by default emit the warning. Added explicit test cases for both C and C++ behavior with the warning turned on. llvm-svn: 108325
* Add a warning to catch a bug recently caught by code review, like this:Chris Lattner2010-07-132-3/+4
| | | | | | | | | | | t2.c:2:12: warning: use of logical && with constant operand; switch to bitwise & or remove constant [-Wlogical-bitwise-confusion] return x && 4; ^ ~ wording improvement suggestions are welcome. llvm-svn: 108260
* Whenever we're creating an expression that is typically an rvalueDouglas Gregor2010-07-131-0/+24
| | | | | | | | | | | | | | | | (e.g., a call, cast, etc.), immediately adjust the expression's type to strip cv-qualifiers off of all non-class types (in C++) or all types (in C). This effectively extends my previous fix for PR7463, which was restricted to calls, to other kinds of expressions within similar characteristics. I've audited every use of getNonReferenceType() in the code base, switching to the newly-renamed getNonLValueExprType() where necessary. Big thanks to Eli for pointing out just how incomplete my original fix for PR7463 actually was. We've been handling cv-qualifiers on rvalues wrong for a very, very long time. Fixes PR7463. llvm-svn: 108253
* Downgrade the "when type is in parentheses, array cannot have dynamicDouglas Gregor2010-07-131-1/+23
| | | | | | | | | | | | size" error for code like new (int [size]) to a warning, add a Fix-It to remove the parentheses, and make this diagnostic work properly when it occurs in a template instantiation. <rdar://problem/8018245>. llvm-svn: 108242
* Improve diagnostics for the "type qualifier on return type has noDouglas Gregor2010-07-132-1/+6
| | | | | | | | | | | | effect warning" by printing the qualifiers we saw and correctly pluralizing the message, e.g., test/SemaCXX/conditional-expr.cpp:295:3: warning: 'const volatile' type qualifiers on return type have no effect const volatile Enum g2() { ^~~~~ ~~~~~~~~ llvm-svn: 108236
* When forming a function call or message send expression, be sure toDouglas Gregor2010-07-133-2/+21
| | | | | | | | | | | | | | | | | strip cv-qualifiers from the expression's type when the language calls for it: in C, that's all the time, while C++ only does it for non-class types. Centralized the computation of the call expression type in QualType::getCallResultType() and some helper functions in other nodes (FunctionDecl, ObjCMethodDecl, FunctionType), and updated all relevant callers of getResultType() to getCallResultType(). Fixes PR7598 and PR7463, along with a bunch of getResultType() call sites that weren't stripping references off the result type (nothing stripped cv-qualifiers properly before this change). llvm-svn: 108234
* Diagnose typedef of an operator name. Fixes PR7462Douglas Gregor2010-07-131-0/+6
| | | | llvm-svn: 108233
* Check in this -Wconversion C++ test case that's been sitting on my machineJohn McCall2010-07-131-0/+45
| | | | | | for awhile. llvm-svn: 108232
* Complain when an unnamed enumeration has no enumerations (inDouglas Gregor2010-07-131-0/+4
| | | | | | C++). Fixes PR7466. llvm-svn: 108231
* Produce an error on encountering a pointer or reference to a qualified ↵Sebastian Redl2010-07-121-0/+5
| | | | | | function type. Fixes PR7470. llvm-svn: 108209
* Instantiation of byref variable inFariborz Jahanian2010-07-091-0/+19
| | | | | | block literal expression. llvm-svn: 108019
* Slightly improve the diagnostic when using a qualified function typedef to ↵Sebastian Redl2010-07-091-2/+2
| | | | | | declare nonmember or static member functions. llvm-svn: 108018
* When looking for an entity's Scope, don't consider scopes that can't contain ↵Sebastian Redl2010-07-081-0/+11
| | | | | | declarations. Fixes PR7594. llvm-svn: 107927
* Allow C-style casts and reinterpret_casts between block pointers andDouglas Gregor2010-07-081-0/+10
| | | | | | either integer values or other pointers. Fixes <rdar://problem/8134521>. llvm-svn: 107905
* Bowing to popular demand, reduce the "comma at end of enumerator list"Douglas Gregor2010-07-081-1/+1
| | | | | | ExtWarn to an Extension. Let the broken code propagate! llvm-svn: 107875
* Reinstate the fix for PR7556. A silly use of isTrivial() wasDouglas Gregor2010-07-081-1/+1
| | | | | | suppressing copies of objects with trivial copy constructors. llvm-svn: 107857
* Revert r107828 and r107827, the fix for PR7556, which seems to beDouglas Gregor2010-07-071-1/+1
| | | | | | breaking bootstrap on Linux. llvm-svn: 107837
* Do not use CXXZeroValueInitExpr for class types. Instead, useDouglas Gregor2010-07-071-1/+1
| | | | | | | | | CXXConstructExpr/CXXTemporaryObjectExpr/CXXNewExpr as appropriate. Fixes PR7556, and provides a slide codegen improvement when copy-initializing a POD class type from a value-initialized temporary. Previously, we weren't eliding the copy. llvm-svn: 107827
* Unbreak test on platforms where size_t != unsigned long.Benjamin Kramer2010-07-031-1/+1
| | | | llvm-svn: 107574
* Mark the operator delete associated with a virtual destructor as referenced.John McCall2010-07-031-0/+17
| | | | llvm-svn: 107573
* By default, warn about commas at the end of an enumerator list in C++/C89.Douglas Gregor2010-07-021-1/+1
| | | | llvm-svn: 107485
OpenPOWER on IntegriCloud