summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/references.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Fix typo from r237482. "to reference of type" --> "to reference to type"Richard Trieu2015-05-161-1/+1
| | | | llvm-svn: 237507
* When emitting a dropped qualifier error, show which qualifiers are dropped.Richard Trieu2015-05-161-1/+1
| | | | llvm-svn: 237505
* Reverse the order of types in the reference dropping qualifiers error.Richard Trieu2015-05-151-1/+1
| | | | | | | | The error has the form ... 'int' ... 'const int' ... dropped qualifiers. At first glance, it appears that the const qualifier is added. Reverse the types so that the second type is less qualified than the first. llvm-svn: 237482
* Reverted OpenCL2.0 atomic type commits r231932, r231935Anastasia Stulova2015-03-111-1/+1
| | | | | | (caused undesirable update of -std flag to use _Atomic) llvm-svn: 231942
* OpenCL: CL2.0 atomic typesAnastasia Stulova2015-03-111-1/+1
| | | | | | | | | | | | OpenCL C Spec v2.0 Section 6.13.11 - Made c11 _Atomic being accepted only for c11 compilations - Implemented CL2.0 atomics by aliasing them to the corresponding c11 atomic types using implicit typedef - Added diagnostics for atomics Khronos extension enabling llvm-svn: 231932
* PR6037Nathan Sidwell2015-01-191-1/+1
| | | | | | Warn on inaccessible direct base llvm-svn: 226423
* PR13110: Add a -Wignored-qualifiers warning when ignoring a const, volatile, orRichard Smith2014-02-191-1/+11
| | | | | | _Atomic qualifier applied to a reference type. llvm-svn: 201620
* When copy-initializing a temporary for a reference binding, don't allow use ofRichard Smith2013-06-131-0/+7
| | | | | | explicit constructors. llvm-svn: 183879
* Better wording for reference self-initialization warning.Hans Wennborg2012-08-201-1/+1
| | | | llvm-svn: 162198
* Warn about self-initialization of references.Hans Wennborg2012-08-171-1/+1
| | | | | | | Initializing a reference with itself, e.g. "int &a = a;" seems like a very bad idea. llvm-svn: 162093
* Fix a crash-on-valid that has been here for a very long time:Chandler Carruth2011-08-221-0/+3
| | | | | | | | | | | | | | | const int &x = x; This crashed by inifinetly recursing within the lvalue evaluation routine. I've added a (somewhat) braindead way of preventing this recursion. If folks have better suggestions for how to avoid it I'm all ears. That said, we have some work to do. This doesn't trigger a single warning for uninitialized, self-initialized or otherwise completely wrong code. In some senses, the crash was almost better. llvm-svn: 138239
* Add another case to the whitelist of cast kinds that can convert to bool.John McCall2010-11-161-0/+4
| | | | | | Fixes PR8608. llvm-svn: 119293
* make clang print types as "const int *" instead of "int const*",Chris Lattner2010-09-051-1/+1
| | | | | | | 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
* Teach ASTContext::getUnqualifiedArrayType() how to look throughDouglas Gregor2010-05-171-0/+15
| | | | | | | typedefs. As a drive-by, teach hit how to build VLA types, since those will eventually be supported in C++. llvm-svn: 103958
* Warn about non-aggregate classes with no user-declared constructorsDouglas Gregor2010-04-151-2/+2
| | | | | | | that have reference or const scalar members, since those members can never be initializer or modified. Fixes <rdar://problem/7804350>. llvm-svn: 101316
* When pretty-printing tag types, only print the tag if we're in C (andJohn McCall2010-03-101-1/+1
| | | | | | | | | | 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
* Diagnose binding a non-const reference to a vector element.Anders Carlsson2010-01-311-0/+13
| | | | llvm-svn: 94963
* 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
* Reimplement reference initialization (C++ [dcl.init.ref]) using theDouglas Gregor2009-12-091-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | new notion of an "initialization sequence", which encapsulates the computation of the initialization sequence along with diagnostic information and the capability to turn the computed sequence into an expression. At present, I've only switched one CheckReferenceInit callers over to this new mechanism; more will follow. Aside from (hopefully) being much more true to the standard, the diagnostics provided by this reference-initialization code are a bit better than before. Some examples: p5-var.cpp:54:12: error: non-const lvalue reference to type 'struct Derived' cannot bind to a value of unrelated type 'struct Base' Derived &dr2 = b; // expected-error{{non-const lvalue reference to ... ^ ~ p5-var.cpp:55:9: error: binding of reference to type 'struct Base' to a value of type 'struct Base const' drops qualifiers Base &br3 = bc; // expected-error{{drops qualifiers}} ^ ~~ p5-var.cpp:57:15: error: ambiguous conversion from derived class 'struct Diamond' to base class 'struct Base': struct Diamond -> struct Derived -> struct Base struct Diamond -> struct Derived2 -> struct Base Base &br5 = diamond; // expected-error{{ambiguous conversion from ... ^~~~~~~ p5-var.cpp:59:9: error: non-const lvalue reference to type 'long' cannot bind to a value of unrelated type 'int' long &lr = i; // expected-error{{non-const lvalue reference to type ... ^ ~ p5-var.cpp:74:9: error: non-const lvalue reference to type 'struct Base' cannot bind to a temporary of type 'struct Base' Base &br1 = Base(); // expected-error{{non-const lvalue reference to ... ^ ~~~~~~ p5-var.cpp:102:9: error: non-const reference cannot bind to bit-field 'i' int & ir1 = (ib.i); // expected-error{{non-const reference cannot ... ^ ~~~~~~ p5-var.cpp:98:7: note: bit-field is declared here int i : 17; // expected-note{{bit-field is declared here}} ^ llvm-svn: 90992
* Make C++ temporary-related expressions provide proper source-range information.Douglas Gregor2009-09-231-0/+15
| | | | llvm-svn: 82665
* 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
* Removed the warningDouglas Gregor2008-12-171-3/+3
| | | | | | | | | | warning: statement was disambiguated as declaration because it is currently firing in cases where the declaration would not actually parse as a statement. We'd love to bring this warning back if we can make it more accurate. llvm-svn: 61137
* Convert IdentifierInfo's to be printed the same as DeclarationNames Chris Lattner2008-11-231-1/+1
| | | | | | | | | | | | | | | | | | | | | with implicit quotes around them. This has a bunch of follow-on effects and requires tweaking to a whole lot of code. This causes a regression in two tests (xfailed) by causing it to emit things like: Line 10: duplicate interface declaration for category 'MyClass1' ('Category1') instead of: Line 10: duplicate interface declaration for category 'MyClass1(Category1)' I will fix this in a follow-up commit. As part of this, I had to start switching stuff to use ->getDeclName() instead of Decl::getName() for consistency. This is good, but I was planning to do this as an independent patch. There will be several follow-on patches to clean up some of the mess, but this patch is already too big. llvm-svn: 59917
* Implement C++ DR 106 and C++ DR 540, both of which deal withDouglas Gregor2008-11-031-0/+12
| | | | | | | | | | | reference-collapsing. Implement diagnostic for formation of a reference to cv void. Drop cv-qualifiers added to a reference type when the reference type comes from a typedef. llvm-svn: 58612
* Temporary disable the const-object-declaration-without-initializer check, ↵Douglas Gregor2008-10-291-3/+0
| | | | | | because it depends on linkage-specifier semantics we don't yet have llvm-svn: 58377
* Implement initialization of a reference (C++ [dcl.init.ref]) as partDouglas Gregor2008-10-291-4/+56
| | | | | | | | | | | | | | | | | | | of copy initialization. Other pieces of the puzzle: - Try/Perform-ImplicitConversion now handles implicit conversions that don't involve references. - Try/Perform-CopyInitialization uses CheckSingleAssignmentConstraints for C. PerformCopyInitialization is now used for all argument passing and returning values from a function. - Diagnose errors with declaring references and const values without an initializer. (Uses a new Action callback, ActOnUninitializedDecl). We do not yet have implicit conversion sequences for reference binding, which means that we don't have any overloading support for reference parameters yet. llvm-svn: 58353
* Move the C++ Sema tests into a separate SemaCXX directory.Argyrios Kyrtzidis2008-08-161-0/+28
llvm-svn: 54853
OpenPOWER on IntegriCloud