summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/static-cast.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Warn when a reference is bound to an empty l-value (dereferenced null pointer).Nick Lewycky2016-05-141-3/+3
| | | | llvm-svn: 269572
* PR 17456Nathan Sidwell2015-01-281-3/+7
| | | | | | More helpful diagnostic on casts between unrelated class hierarchies. llvm-svn: 227371
* Sema: Fix crash during member pointer conversion involving incomplete classesDavid Majnemer2014-01-161-0/+3
| | | | | | | | | | | | | We would attempt to determine the inheritance relationship between classes 'A' and 'B' during static_cast if we tried to convert from 'int A::*' to 'int B::*'. However, the question "does A derive from B" is not meaningful when 'A' isn't defined. Handle this case by requiring that 'A' be defined. This fixes PR18506. llvm-svn: 199374
* Revert "Don't require -re suffix on -verify directives with regexes."Alp Toker2013-12-141-1/+1
| | | | | | | | | | 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-1/+1
| | | | | | Differential Revision: http://llvm-reviews.chandlerc.com/D2392 llvm-svn: 197295
* Tighten test regexes checking for __attribute__((thiscall)) on function types.Hans Wennborg2013-12-131-1/+1
| | | | | | | | | | | The tests were perhaps made too relaxed in r197164 when we switched to the new MinGW ABI. This makes sure we check explicitly for an optional thiscall attribute and nothing else. We should still look into whether we should print these attributes at all in these cases. llvm-svn: 197252
* Switch to the new MingW ABI.Rafael Espindola2013-12-121-1/+1
| | | | | | | GCC 4.7 changed the MingW ABI. On the clang side this means that methods now have the thiscall calling convention by default. llvm-svn: 197164
* Implement appropriate semantics for C++ casting and conversion whenDouglas Gregor2011-04-151-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | dealing with address-space- and GC-qualified pointers. Previously, these qualifiers were being treated just like cvr-qualifiers (in some cases) or were completely ignored, leading to uneven behavior. For example, const_cast would allow conversion between pointers to different address spaces. The new semantics are fairly simple: reinterpret_cast can be used to explicitly cast between pointers to different address spaces (including adding/removing addresss spaces), while static_cast/dynamic_cast/const_cast do not tolerate any changes in the address space. C-style casts can add/remove/change address spaces through the reinterpret_cast mechanism. Other non-CVR qualifiers (e.g., Objective-C GC qualifiers) work similarly. As part of this change, I tweaked the "casts away constness" diagnostic to use the term "casts away qualifiers". The term "constness" actually comes from the C++ standard, despite the fact that removing "volatile" also falls under that category. In Clang, we also have restrict, address spaces, ObjC GC attributes, etc., so the more general "qualifiers" is clearer. llvm-svn: 129583
* Properly diagnose invalid casts to function references. Patch byDouglas Gregor2010-11-081-2/+2
| | | | | | Faisal Vali, tweaked by me. Fixes PR8230. llvm-svn: 118400
* 'const std::type_info*' instead of 'std::type_info const*'Chris Lattner2010-09-051-2/+2
| | | | llvm-svn: 113092
* make clang print types as "const int *" instead of "int const*",Chris Lattner2010-09-051-2/+2
| | | | | | | which is should have done from the beginning. As usual, the most fun with this sort of change is updating all the testcases. llvm-svn: 113090
* Turn access control on by default in -cc1.John McCall2010-04-091-1/+1
| | | | | | | | Remove -faccess-control from -cc1; add -fno-access-control. Make the driver pass -fno-access-control by default. Update a bunch of tests to be correct under access control. llvm-svn: 100880
* Switch static_cast from the old reference-initialization code (viaDouglas Gregor2010-03-241-2/+2
| | | | | | | | CheckReferenceInit) over to the new initialization code (InitializationSequence), which is better-tested and doesn't require us to compute the entire conversion sequence twice. llvm-svn: 99452
* When pretty-printing tag types, only print the tag if we're in C (andJohn McCall2010-03-101-18/+18
| | | | | | | | | | therefore not creating ElaboratedTypes, which are still pretty-printed with the written tag). Most of these testcase changes were done by script, so don't feel too sorry for my fingers. llvm-svn: 98149
* Perform overload resolution when static_cast'ing from aDouglas Gregor2010-03-071-0/+14
| | | | | | | pointer-to-member-to-derived to a pointer-to-member-to-base. Fixes PR6072. llvm-svn: 97923
* Improve access control diagnostics. Perform access control on member-pointerJohn McCall2010-02-101-4/+4
| | | | | | | conversions. Fix an access-control bug where privileges were not considered at intermediate points along the inheritance path. Prepare for friends. llvm-svn: 95775
* Fix my dyslexia.Chandler Carruth2010-01-311-1/+1
| | | | llvm-svn: 94958
* Add a test case for a fixed PR just to ensure we don't regress.Chandler Carruth2010-01-311-0/+3
| | | | llvm-svn: 94957
* 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
* When performing a static downcast as part of a static_cast, make sureDouglas Gregor2009-11-151-1/+17
| | | | | | | | | | that we're dealing with canonical types like the documentation say (yay, CanQualType). Alas, this is another instance where using getQualifiers() on a non-canonical QualType got us in trouble. Good news: with this fix, Clang can now parse all of its own headers! llvm-svn: 88848
* - Have TryStaticImplicitCast set the cast kind to NoOp when binding a ↵Sebastian Redl2009-11-141-3/+3
| | | | | | | | | reference. CheckReferenceInit already inserts implicit casts to the necessary types. This fixes an assertion in CodeGen for some casts and brings a fix for PR5453 close, if I understand that bug correctly. - Also, perform calculated implicit cast sequences if they're determined to work. This finally diagnoses static_cast to ambiguous or implicit bases and fixes two long-standing fixmes in the test case. For the C-style cast, this requires propagating the access check suppression pretty deep into other functions. - Pass the expressions for TryStaticCast and TryStaticImplicitCast by reference. This should lead to a better AST being emitted for such casts, and also fixes a memory leak, because CheckReferenceInit and PerformImplicitConversion wrap the node passed to them. These wrappers were previously lost. llvm-svn: 88809
* When type-checking a static cast (or the static_cast part of a C-styleDouglas Gregor2009-11-141-0/+18
| | | | | | | | cast) that is converting to a class type, enumerate its constructors as in any other direct initialization. This ensures that we get the proper conversion sequence. llvm-svn: 88751
* Try to instantiate templates before doing hierarchy checks in static_cast. ↵Sebastian Redl2009-10-221-0/+11
| | | | | | Fixes PR5261. llvm-svn: 84860
* Implement C++ semantics for C-style and functional-style casts. This ↵Sebastian Redl2009-07-251-8/+14
| | | | | | | | regresses Clang extension conversions, like vectors, but allows conversions via constructors and conversion operators. Add custom conversions to static_cast. llvm-svn: 77076
* Use "()" instead of "(void)" when pretty-printing a parameter-less function ↵Argyrios Kyrtzidis2009-06-031-1/+1
| | | | | | type for C++. llvm-svn: 72747
* Rename clang to clang-cc.Daniel Dunbar2009-03-241-1/+1
| | | | | | Tests and drivers updated, still need to shuffle dirs. llvm-svn: 67602
* Almost complete implementation of rvalue references. One bug, and a few ↵Sebastian Redl2009-03-161-2/+2
| | | | | | unclear areas. Maybe Doug can shed some light on some of the fixmes. llvm-svn: 67059
* Implement pointer to member handling in static_cast.Sebastian Redl2009-01-281-1/+11
| | | | | | | Fix a stupid mistake in UnwrapSimilarPointers that made any two member pointers compatible as long as the pointee was the same. Make a few style corrections as suggested by Chris. llvm-svn: 63215
* Greatly improve static_cast diagnosticsSebastian Redl2008-11-071-11/+10
| | | | llvm-svn: 58873
* A small error message improvement and some comment cleanup for static_cast.Sebastian Redl2008-11-051-1/+1
| | | | llvm-svn: 58762
* Implement semantic checking of static_cast and dynamic_cast.Sebastian Redl2008-10-311-0/+120
llvm-svn: 58509
OpenPOWER on IntegriCloud