summaryrefslogtreecommitdiff
path: root/test/CXX
Commit message (Collapse)AuthorAgeFilesLines
* Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'.Daniel Dunbar2009-12-15179-179/+179
| | | | | | | | | - 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). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91446 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix some diagnostic-related FIXMEs, from Nicola GiganteDouglas Gregor2009-12-151-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91433 91177308-0d34-0410-b5e6-96231b3b80d8
* Diagnose the use of typedefs for template specialization types in the scopeJohn McCall2009-12-151-0/+12
| | | | | | | | | | specifiers for out-of-line declarations, e.g. typedef Temp<int> MyTemp; template <> MyTemp::foo; git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91395 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix test.Anders Carlsson2009-12-131-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91245 91177308-0d34-0410-b5e6-96231b3b80d8
* More improvements to checking allocation and deallocation functions.Anders Carlsson2009-12-131-0/+32
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91244 91177308-0d34-0410-b5e6-96231b3b80d8
* Correctly diagnose [basic.stc.dynamic.allocation]p1Anders Carlsson2009-12-121-0/+12
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91190 91177308-0d34-0410-b5e6-96231b3b80d8
* Improve diagnostics for malformed delete operator function declarations.Anders Carlsson2009-12-112-1/+12
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91180 91177308-0d34-0410-b5e6-96231b3b80d8
* Test member template using hiding.John McCall2009-12-111-2/+45
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91099 91177308-0d34-0410-b5e6-96231b3b80d8
* Check if the target of a using decl is already declared in this scope beforeJohn McCall2009-12-111-0/+14
| | | | | | | | | doing any of the other redeclaration checks. We were missing a few cases. Fixes PR 5752. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91096 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement access declarations. Most of the work here is parsing them, whichJohn McCall2009-12-111-0/+199
| | | | | | | | | | | | | is difficult because they're so terribly, terribly ambiguous. We implement access declarations in terms of using declarations, which is quite reasonable. However, we should really persist the access/using distinction in the AST and use the appropriate name in diagnostics. This isn't a priority, so I'll just file a PR and hope someone else does it. :) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91095 91177308-0d34-0410-b5e6-96231b3b80d8
* Actually try to trigger the last diagnostic in the declaration-collision ↵John McCall2009-12-101-4/+9
| | | | | | | | | | | test case. Surprisingly, we *do* diagnose one of them. Since we don't really track scopes into instantiation, this has to signal some kind of bug. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91063 91177308-0d34-0410-b5e6-96231b3b80d8
* Improve the diagnostic when a new declaration conflicts with a using shadowJohn McCall2009-12-101-0/+89
| | | | | | | | | | declaration. Rename note_using_decl to note_using, which is possibly less confusing. Add a test for non-class-scope using decl collisions and be sure to note the case we can't diagnose yet. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91057 91177308-0d34-0410-b5e6-96231b3b80d8
* Move initialization via initializer list over to InitializationSequences.Douglas Gregor2009-12-101-0/+5
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91050 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement redeclaration checking and hiding semantics for using ↵John McCall2009-12-103-0/+190
| | | | | | | | | | | | | declarations. There are a couple of O(n^2) operations in this, some analogous to the usual O(n^2) redeclaration problem and some not. In particular, retroactively removing shadow declarations when they're hidden by later decls is pretty unfortunate. I'm not yet convinced it's worse than the alternative, though. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91045 91177308-0d34-0410-b5e6-96231b3b80d8
* Reimplement reference initialization (C++ [dcl.init.ref]) using theDouglas Gregor2009-12-094-0/+199
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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}} ^ git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90992 91177308-0d34-0410-b5e6-96231b3b80d8
* Handle unresolved using decls in bare lookups. These are not being adequatelyJohn McCall2009-12-081-0/+13
| | | | | | | | tested. Fixes PR5727. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90893 91177308-0d34-0410-b5e6-96231b3b80d8
* Correctly implement the C++03 and 0x restrictions on class-member usingJohn McCall2009-12-082-5/+60
| | | | | | | | declarations. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90843 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove empty test casesDouglas Gregor2009-12-073-0/+0
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90749 91177308-0d34-0410-b5e6-96231b3b80d8
* PointerUnion == PointerUnion does not do what I thought it did. Also, fix a ↵Douglas Gregor2009-12-063-0/+0
| | | | | | thinko in a PointerUnion::get call. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90719 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix "using typename" and the instantiation of non-dependent using declarations.John McCall2009-12-041-0/+183
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90614 91177308-0d34-0410-b5e6-96231b3b80d8
* Honor using declarations in overload resolution. Most of the code forJohn McCall2009-12-031-0/+63
| | | | | | | | | | | | | overloaded-operator resolution is wildly untested, but the parallel code for methods seems to satisfy some trivial tests. Also change some overload-resolution APIs to take a type instead of an expression, which lets us avoid creating a spurious CXXThisExpr when resolving implicit member accesses. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90410 91177308-0d34-0410-b5e6-96231b3b80d8
* Use a more rigorous definition of 'class member'. I don't have any evidenceJohn McCall2009-12-021-0/+20
| | | | | | | | that this was causing a problem, but it could have. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90343 91177308-0d34-0410-b5e6-96231b3b80d8
* Stop trying to analyze class-hierarchies for dependently-scoped id-expressions;John McCall2009-12-021-0/+93
| | | | | | | | | | | | | | there's nothing interesting we can say now that we're correctly not requiring the qualifier to name a known base class in dependent contexts. Require scope specifiers on member access expressions to name complete types if they're not dependent; delay lookup when they are dependent. Use more appropriate diagnostics when qualified implicit member access expressions find declarations from unrelated classes. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90289 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement the rules in C++ [basic.link] and C99 6.2.2 for computingDouglas Gregor2009-11-251-0/+11
| | | | | | | | | | | | | the linkage of a declaration. Switch the lame (and completely wrong) NamedDecl::hasLinkage() over to using the new NamedDecl::getLinkage(), along with the "can this declaration be a template argument?" check that started all of this. Fixes -fsyntax-only for PR5597. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89891 91177308-0d34-0410-b5e6-96231b3b80d8
* Tweak expected error message, although we still fail this testDouglas Gregor2009-11-251-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89875 91177308-0d34-0410-b5e6-96231b3b80d8
* Diagnose ill-formed uses of default template arguments inDouglas Gregor2009-11-251-0/+23
| | | | | | | | | | | | function templates (in C++98), friend function templates, and out-of-line definitions of members of class templates. Also handles merging of default template arguments from previous declarations of function templates, for C++0x. However, we don't yet make use of those default template arguments. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89872 91177308-0d34-0410-b5e6-96231b3b80d8
* Canonical template arguments that are template template parameters byDouglas Gregor2009-11-231-1/+22
| | | | | | | | their template parameter depth and position, so that we can match redeclarations appropriately. Fixes PR5527 and PR5528. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89654 91177308-0d34-0410-b5e6-96231b3b80d8
* "Incremental" progress on using expressions, by which I mean totally rippingJohn McCall2009-11-211-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | into pretty much everything about overload resolution in order to wean BuildDeclarationNameExpr off LookupResult::getAsSingleDecl(). Replace UnresolvedFunctionNameExpr with UnresolvedLookupExpr, which generalizes the idea of a non-member lookup that we haven't totally resolved yet, whether by overloading, argument-dependent lookup, or (eventually) the presence of a function template in the lookup results. Incidentally fixes a problem with argument-dependent lookup where we were still performing ADL even when the lookup results contained something from a block scope. Incidentally improves a diagnostic when using an ObjC ivar from a class method. This just fell out from rewriting BuildDeclarationNameExpr's interaction with lookup, and I'm too apathetic to break it out. The only remaining uses of OverloadedFunctionDecl that I know of are in TemplateName and MemberExpr. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89544 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement C++ [temp.param]p2 correctly, looking ahead when we see aDouglas Gregor2009-11-211-1/+2
| | | | | | | | "typename" parameter to distinguish between non-type and type template parameters. Fixes the actual bug in PR5559. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89532 91177308-0d34-0410-b5e6-96231b3b80d8
* Cope with extraneous "template" keyword when providing an out-of-lineDouglas Gregor2009-11-202-1/+11
| | | | | | | definition of a member template (or a member thereof). Fixes PR5566. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89512 91177308-0d34-0410-b5e6-96231b3b80d8
* Pretend destructors are const and volatile. This allows calling them with ↵Sebastian Redl2009-11-181-0/+7
| | | | | | const and/or volatile objects. Fixes PR5548. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89244 91177308-0d34-0410-b5e6-96231b3b80d8
* Improve on diagnosing type mismatches because of Fariborz Jahanian2009-11-182-5/+5
| | | | | | | lack of viable convesion functions. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89216 91177308-0d34-0410-b5e6-96231b3b80d8
* Incremental progress on using declarations. Split UnresolvedUsingDecl intoJohn McCall2009-11-181-4/+27
| | | | | | | | | | | | two classes, one for typenames and one for values; this seems to have some support from Doug if not necessarily from the extremely-vague-on-this-point standard. Track the location of the 'typename' keyword in a using-typename decl. Make a new lookup result for unresolved values and deal with it in most places. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89184 91177308-0d34-0410-b5e6-96231b3b80d8
* Commit this random test case.John McCall2009-11-171-0/+44
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89068 91177308-0d34-0410-b5e6-96231b3b80d8
* Deallocation functions must also be static.Anders Carlsson2009-11-151-0/+11
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@88859 91177308-0d34-0410-b5e6-96231b3b80d8
* allocation functions are always static.Anders Carlsson2009-11-151-0/+11
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@88858 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix broken tests, exposed by improved -verify.Daniel Dunbar2009-11-141-2/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@88749 91177308-0d34-0410-b5e6-96231b3b80d8
* Add test for expr.delete p5, with a FIXME.Daniel Dunbar2009-11-131-0/+34
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@88678 91177308-0d34-0410-b5e6-96231b3b80d8
* Improve diagnostics when a default template argument does not matchDouglas Gregor2009-11-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | with its corresponding template parameter. This can happen when we performed some substitution into the default template argument and what we had doesn't match any more, e.g., template<int> struct A; template<typename T, template<T> class X = A> class B; B<long> b; Previously, we'd emit a pretty but disembodied diagnostic showing how the default argument didn't match the template parameter. The diagnostic was good, but nothing tied it to the *use* of the default argument in "B<long>". This commit fixes that. Also, tweak the counting of active template instantiations to avoid counting non-instantiation records, such as those we create for (surprise!) checking default arguments, instantiating default arguments, and performing substitutions as part of template argument deduction. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86884 91177308-0d34-0410-b5e6-96231b3b80d8
* Before checking a template template argument against its correspondingDouglas Gregor2009-11-111-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | template template parameter, substitute any prior template arguments into the template template parameter. This, for example, allows us to properly check the template template argument for a class such as: template<typename T, template<T Value> class X> struct Foo; The actual implementation of this feature was trivial; most of the change is dedicated to giving decent diagnostics when this substitution goes horribly wrong. We now get a note like: note: while substituting prior template arguments into template template parameter 'X' [with T = float] As part of this change, enabled some very pedantic checking when comparing template template parameter lists, which shook out a bug in our overly-eager checking of default arguments of template template parameters. We now perform only minimal checking of such default arguments when they are initially parsed. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86864 91177308-0d34-0410-b5e6-96231b3b80d8
* Create a new Scope when parsing a declaration with a C++ scope specifier.John McCall2009-11-111-0/+13
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86764 91177308-0d34-0410-b5e6-96231b3b80d8
* Make a somewhat more convincing test case for unqualified lookup throughJohn McCall2009-11-101-0/+128
| | | | | | | | | | | using directives, and fix a bug thereby exposed: since we're playing tricks with pointers, we need to make certain we're always using the same pointers for things. Also tweak an existing error message. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86679 91177308-0d34-0410-b5e6-96231b3b80d8
* Simple test case for [basic.lookup.udir].John McCall2009-11-101-0/+35
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86674 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix unqualified lookup through using directives.John McCall2009-11-101-0/+24
| | | | | | | | This is a pretty minimal test case; I'll make a better one later. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86669 91177308-0d34-0410-b5e6-96231b3b80d8
* Add additional note to mark the cause of synthesized constructors. MarkEli Friedman2009-11-091-1/+1
| | | | | | | | | declaration invalid if the constructor can't be properly built. Addresses remaining review comments from Fariborz for r86500. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86579 91177308-0d34-0410-b5e6-96231b3b80d8
* Unify the codepaths used to verify base and member initializers for explicitlyEli Friedman2009-11-091-3/+2
| | | | | | | | | | | | | | | | | | and implicitly defined constructors. This has a number of benefits: 1. Less code. 2. Explicit and implicit constructors get the same diagnostics. 3. The AST explicitly contains constructor calls from implicit default constructors. This allows handing some cases that previously weren't handled correctly in IRGen without any additional code. Specifically, implicit default constructors containing calls to constructors with default arguments are now handled correctly. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86500 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove RUN: true lines.Daniel Dunbar2009-11-081-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86432 91177308-0d34-0410-b5e6-96231b3b80d8
* Eliminate &&s in tests.Daniel Dunbar2009-11-083-3/+3
| | | | | | - 'for i in $(find . -type f); do sed -e 's#\(RUN:.*[^ ]\) *&& *$#\1#g' $i | FileUpdate $i; done', for the curious. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86430 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't allow definitions of array variables without some size information in ↵Sebastian Redl2009-11-051-1/+1
| | | | | | C++. Fixed PR5401 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86165 91177308-0d34-0410-b5e6-96231b3b80d8
* Allow the element type of arrays to be incomplete in C++.Sebastian Redl2009-11-051-0/+44
| | | | | | This fixes PR5048. Also fix a bug where zero-sized arrays weren't warned about when the size was unsigned. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86136 91177308-0d34-0410-b5e6-96231b3b80d8