aboutsummaryrefslogtreecommitdiff
path: root/test/CXX
AgeCommit message (Collapse)Author
2013-05-06Grab-bag of bit-field fixes:John McCall
- References to ObjC bit-field ivars are bit-field lvalues; fixes rdar://13794269, which got me started down this. - Introduce Expr::refersToBitField, switch a couple users to it where semantically important, and comment the difference between this and the existing API. - Discourage Expr::getBitField by making it a bit longer and less general-sounding. - Lock down on const_casts of bit-field gl-values until we hear back from the committee as to whether they're allowed. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181252 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-06C++1y: support 'for', 'while', and 'do ... while' in constant expressions.Richard Smith
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181181 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-05C++1y: support for increment and decrement in constant expression evaluation.Richard Smith
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181173 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-05Factor out duplication between lvalue-to-rvalue conversions and variableRichard Smith
assignments in constant expressions. No significant functionality changes (slight improvement to potential constant expression checking). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181170 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-04Implement most of N3638 (return type deduction for normal functions).Richard Smith
Missing (somewhat ironically) is support for the new deduction rules in lambda functions, plus PCH support for return type patching. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181108 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-04Don't build a call expression referring to a function which we're not allowedRichard Smith
to use. This makes very little difference right now (other than suppressing follow-on errors in some cases), but will matter more once we support deduced return types (we don't want expressions with undeduced return types in the AST). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181107 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-04Say 'decltype(auto)' not 'auto' as appropriate in mismatched-deduction ↵Richard Smith
diagnostic. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181103 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-04Separate out and special-case the diagnostic for 'auto' in aRichard Smith
conversion-type-id, in preparation for this becoming valid in c++1y mode. No functionality change; small diagnostic improvement. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181089 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-02Fix crasher when the range in a C++ range-for loop has an ill-formed ↵Douglas Gregor
initializer. Fixes <rdar://problem/13712739>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180937 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-26Implement C++1y decltype(auto).Richard Smith
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180610 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-25Don't mark 'extern "C" void f(void)' as having extern storage class.Rafael Espindola
Instead, we check for one line extern "C" context in linkage computation and when deciding if a variable is a definition. This hopefully completes the transition to having "as written" semantics for hasExternalStorage. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180258 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-22C++1y constexpr extensions, round 1: Allow most forms of declaration andRichard Smith
statement in constexpr functions. Everything which doesn't require variable mutation is also allowed as an extension in C++11. 'void' becomes a literal type to support constexpr functions which return 'void'. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180022 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-21The 'constexpr implies const' rule for non-static member functions is gone inRichard Smith
C++1y, so stop adding the 'const' there. Provide a compatibility warning for code relying on this in C++11, with a fix-it hint. Update our lazily-written tests to add the const, except for those ones which were testing our implementation of this rule. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179969 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-20C++1y: Allow aggregates to have default initializers.Richard Smith
Add a CXXDefaultInitExpr, analogous to CXXDefaultArgExpr, and use it both in CXXCtorInitializers and in InitListExprs to represent a default initializer. There's an additional complication here: because the default initializer can refer to the initialized object via its 'this' pointer, we need to make sure that 'this' points to the right thing within the evaluation. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179958 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-17PR15755: don't drop parameter packs when dropping parameters with defaultRichard Smith
arguments in the formation of a candidate set of inheriting constructors. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179708 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-17DR974: Lambdas can have default arguments.Richard Smith
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179688 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-15Add triples to these tests since they're now using TLS, which isn't ↵Richard Smith
available on all targets. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179514 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-13Annotate flavor of TLS variable (statically or dynamically initialized) onto ↵Richard Smith
the AST. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179447 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-12Parsing support for thread_local and _Thread_local. We give them the sameRichard Smith
semantics as __thread for now. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179424 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-11Force a load when creating a reference to a temporary copied from a bitfield.Jordan Rose
For this source: const int &ref = someStruct.bitfield; We used to generate this AST: DeclStmt [...] `-VarDecl [...] ref 'const int &' `-MaterializeTemporaryExpr [...] 'const int' lvalue `-ImplicitCastExpr [...] 'const int' lvalue <NoOp> `-MemberExpr [...] 'int' lvalue bitfield .bitfield [...] `-DeclRefExpr [...] 'struct X' lvalue ParmVar [...] 'someStruct' 'struct X' Notice the lvalue inside the MaterializeTemporaryExpr, which is very confusing (and caused an assertion to fire in the analyzer - PR15694). We now generate this: DeclStmt [...] `-VarDecl [...] ref 'const int &' `-MaterializeTemporaryExpr [...] 'const int' lvalue `-ImplicitCastExpr [...] 'int' <LValueToRValue> `-MemberExpr [...] 'int' lvalue bitfield .bitfield [...] `-DeclRefExpr [...] 'struct X' lvalue ParmVar [...] 'someStruct' 'struct X' Which makes a lot more sense. This allows us to remove code in both CodeGen and AST that hacked around this special case. The commit also makes Clang accept this (legal) C++11 code: int &&ref = std::move(someStruct).bitfield PR15694 / <rdar://problem/13600396> git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179250 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-10Add support for computing the exception specification for an inheritingRichard Smith
constructor. This isn't quite perfect (as usual, we don't handle default arguments correctly yet, and we don't deal with copy/move constructors for arguments correctly either, but this will be fixed when we implement core issue 1351. This completes our support for inheriting constructors. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179154 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-10C++11 inheriting constructors: support for inheriting constructor templates.Richard Smith
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179151 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-10<rdar://problem/13605348> Don't consider invalid user-defined literal ↵Douglas Gregor
operators during overload resolution. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179150 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-09Skip transparent contexts when looking for using directives in name lookup.Douglas Gregor
Fixes the bootstrap regression I introduced in r179067. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179079 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-08<rdar://problem/13584715> Converted constant expressions are expected to ↵Douglas Gregor
have integral values. We were assuming that any expression used as a converted constant expression would either not have a folded constant value or would be an integer, which is not the case for some ill-formed constant expressions. Because converted constant expressions are only used where integral values are expected, we can simply treat this as an error path. If that ever changes, we'll need to widen the interface of Sema::CheckConvertedConstantExpression() anyway. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179068 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-08<rdar://problem/13540899> Collect using directives from all of the semantic ↵Douglas Gregor
contexts not represented by scopes. This fixes a regression I introduced in r178136, where we would not consider the using directives from the semantic declaration contexts that aren't represented by the lexical scopes (Scope) when performing unqualified name lookup. This lead to horribly funny diagnostics like "no identifier named 'foo'; did you mean 'foo'?". git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179067 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-02If a defaulted special member is implicitly deleted, check whether it'sRichard Smith
overriding a non-deleted virtual function. The existing check for this doesn't catch this case, because it fires before we mark the method as deleted. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178563 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-01Only merge down a variable type if the previous declaration wasJohn McCall
visible. There's a lot of potential badness in how we're modelling these things, but getting this much correct is reasonably easy. rdar://13535367 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178488 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-27<rdar://problem/13317030> Consider using directives when performing ↵Douglas Gregor
unqualified name lookup into declarations contexts represented by the qualified-id but not in the actual scope hierarchy. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178136 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-26<rdar://problem/13278115> Improve diagnostic when failing to bind an rvalue ↵Douglas Gregor
reference to an lvalue of compatible type. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178095 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-26<rdar://problem/13473493> Handle 'this->' insertion recovery within trailing ↵Douglas Gregor
return types. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178081 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-26Remove FIXMEs: these are covered by a core issue which we don't yet implementRichard Smith
(but we happen to get this part right). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177958 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-26Implement special-case name lookup for inheriting constructors: memberRichard Smith
using-declarations with names which look constructor-like are interpreted as constructor names. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177957 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-25<rdar://problem/13395022> Strip references when extracting an ↵Douglas Gregor
initializer_list's element type during application of an initialization sequence. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177944 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-20Don't look outside the innermost enclosing namespace whenJohn McCall
performing unqualified lookup for a friend class declaration. rdar://13393749 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177473 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-18Bring inheriting constructor implementation up-to-date with current defectRichard Smith
reports, and implement implicit definition of inheriting constructors. Remaining missing features: inheriting constructor templates, implicit exception specifications for inheriting constructors, inheriting constructors from dependent bases. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177320 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-15PR15290: 'this' is not permitted in the declaration of a friend function,Richard Smith
therefore references to members should not be transformed into implicit uses of 'this'. Patch by Ismail Pazarbasi! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177134 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-06PR15390: If a function returns a pointer to a function, that function typeRichard Smith
can't have default arguments even though it's a parameter-declaration-clause in a function declaration. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176542 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-05Add quotation marks to template names in diagnostics.David Blaikie
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176474 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-27Don't crash when diagnosing path-constrained protectedJohn McCall
access to a private member to which we have special access. rdar://12926092 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176146 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-22Don't crash if we try to apply 'alignas' to a variable declared with anRichard Smith
incomplete type. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175880 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-22Update to use references to attribute groups instead of listing the ↵Bill Wendling
attributes on the call/invoke instructions. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175878 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-22Implement C++11 [dcl.align]p6-p8, and C11 6.7.5/7. This had to be split out ofRichard Smith
the normal attribute-merging path, because we can't merge alignment attributes without knowing the complete set of alignment attributes which apply to a particular declaration. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175861 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-22Only suppress instance context if a member is actuallyJohn McCall
accessible in its declaring class; otherwise we might fail to apply [class.protected] when considering accessibility in derived classes. Noticed by inspection; <rdar://13270329>. I had an existing test wrong. Here's why it's wrong: Follow the rules (and notation) of [class.access]p5. The naming class (N) is B and the context (R) is D::getX. - 'x' as a member of B is protected, but R does not occur in a member or friend of a class derived from B. - There does exist a base class of B, A, which is accessible from R, and 'x' is accessible at R when named in A because 'x' as a member of A is protected and R occurs in a member of a class, D, that is derived from A; however, by [class.protected], the class of the object expression must be equal to or derived from that class, and A does not derive from D. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175858 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-21Try to get buildbots to pass these tests.Bill Wendling
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175784 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-20Attempt to clean up tests for non-X86 platforms.Bill Wendling
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175652 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-20Remove target-specific features.Bill Wendling
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175610 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-20Modify the tests to use attribute group references instead of listing theBill Wendling
function attributes. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175606 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-12Add a test for r174980, that we used to acceptDmitri Gribenko
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175005 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-12Accept over-qualified constructor in MSVC emulation modeDmitri Gribenko
MSVC accepts this: class A { A::A(); }; Clang accepts regular member functions with extra qualification as an MS extension, but not constructors. This changes the parser to defer rejecting qualified constructors so that the same Sema logic can apply to constructors as regular member functions. This also improves the error message when MS extensions are disabled (in my opinion). Before it was: /Users/jason/Desktop/test.cpp:2:8: error: expected member name or ';' after declaration specifiers A::A(); ~~~~ ^ 1 error generated. After: /Users/jason/Desktop/test.cpp:2:6: error: extra qualification on member 'A' A::A(); ~~~^ 1 error generated. Patch by Jason Haslam. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174980 91177308-0d34-0410-b5e6-96231b3b80d8