• Home
  • History
  • Annotate
  • only in /external/clang/test/CXX/expr/
History log of /external/clang/test/CXX/expr/
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
6bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89 29-May-2014 Stephen Hines <srhines@google.com> Update Clang for 3.5 rebase (r209713).

Change-Id: I8c9133b0f8f776dc915f270b60f94962e771bc83
xpr.const/p2-0x.cpp
xpr.prim/expr.prim.lambda/blocks.mm
651f13cea278ec967336033dd032faef0e9fc2ec 24-Apr-2014 Stephen Hines <srhines@google.com> Updated to Clang 3.5a.

Change-Id: I8127eb568f674c2e72635b639a3295381fe8af82
xpr.const/p2-0x.cpp
xpr.const/p3-0x.cpp
xpr.mptr.oper/p5.cpp
xpr.mptr.oper/p6-0x.cpp
xpr.prim/expr.prim.general/p4-0x.cpp
xpr.prim/expr.prim.lambda/blocks.mm
xpr.prim/expr.prim.lambda/generic-lambda-unimplemented-1y.cpp
xpr.prim/expr.prim.lambda/p14.cpp
xpr.prim/expr.prim.lambda/p19.cpp
xpr.prim/expr.prim.lambda/p2-generic-lambda-1y.cpp
xpr.prim/expr.prim.lambda/p5-generic-lambda-1y.cpp
xpr.unary/expr.new/p2-cxx0x.cpp
xpr.unary/expr.unary.op/p4.cpp
xpr.unary/expr.unary.op/p6.cpp
c00e4194296e994efab0e4bf64ca66737850bdf0 07-Nov-2013 Faisal Vali <faisalv@yahoo.com> This patch implements capturing of variables within generic lambdas.

Both Richard and I felt that the current wording in the working paper needed some tweaking - Please see http://llvm-reviews.chandlerc.com/D2035 for additional context and references to core-reflector messages that discuss wording tweaks.

What is implemented is what we had intended to specify in Bristol; but, recently felt that the specification might benefit from some tweaking and fleshing.

As a rough attempt to explain the semantics: If a nested lambda with a default-capture names a variable within its body, and if the enclosing full expression that contains the name of that variable is instantiation-dependent - then an enclosing lambda that is capture-ready (i.e. within a non-dependent context) must capture that variable, if all intervening nested lambdas can potentially capture that variable if they need to, and all intervening parent lambdas of the capture-ready lambda can and do capture the variable.

Of note, 'this' capturing is also currently underspecified in the working paper for generic lambdas. What is implemented here is if the set of candidate functions in a nested generic lambda includes both static and non-static member functions (regardless of viability checking - i.e. num and type of parameters/arguments) - and if all intervening nested-inner lambdas between the capture-ready lambda and the function-call containing nested lambda can capture 'this' and if all enclosing lambdas of the capture-ready lambda can capture 'this', then 'this' is speculatively captured by that capture-ready lambda.

Hopefully a paper for the C++ committee (that Richard and I had started some preliminary work on) is forthcoming.

This essentially makes generic lambdas feature complete, except for known bugs. The more prominent ones (and the ones I am currently aware of) being:
- generic lambdas and init-captures are broken - but a patch that fixes this is already in the works ...
- nested variadic expansions such as:
auto K = [](auto ... OuterArgs) {
vp([=](auto ... Is) {
decltype(OuterArgs) OA = OuterArgs;
return 0;
}(5)...);
return 0;
};
auto M = K('a', ' ', 1, " -- ", 3.14);
currently cause crashes. I think I know how to fix this (since I had done so in my initial implementation) - but it will probably take some work and back & forth with Doug and Richard.

A warm thanks to all who provided feedback - and especially to Doug Gregor and Richard Smith for their pivotal guidance: their insight and prestidigitation in such matters is boundless!

Now let's hope this commit doesn't upset the buildbot gods ;)

Thanks!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194188 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.prim/expr.prim.lambda/generic-lambda-unimplemented-1y.cpp
xpr.prim/expr.prim.lambda/p2-generic-lambda-1y.cpp
xpr.prim/expr.prim.lambda/p5-generic-lambda-1y.cpp
9d33c40838367ffcc3206a7120a0ce32922b66d8 25-Oct-2013 David Majnemer <david.majnemer@gmail.com> Sema: Do not allow lambda expressions to appear inside of constant expressions

We would previously not diagnose this which would lead to crashes (on
very strange code).

This fixes PR17675.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193397 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.const/p2-0x.cpp
a3d311e468bce37defb97ed75105f8d36942b651 23-Oct-2013 Faisal Vali <faisalv@yahoo.com> And Again: Teach TreeTransform how to transform nested generic lambdas.


A previous attempt http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20130930/090049.html resulted in PR 17476, and was reverted,

The original TransformLambdaExpr (pre generic-lambdas) transformed the TypeSourceInfo of the Call operator in its own instantiation scope via TransformType. This resulted in the parameters of the call operator being mapped to their transformed counterparts in an instantiation scope that would get popped off.
Then a call to TransformFunctionParameters would add the parameters and their transformed mappings (but newly created ones!) to the current instantiation scope. This would result in a disconnect between the new call operator's TSI parameters and those used to construct the call operator declaration. This was ok in the non-generic lambda world - but would cause issues with nested transformations (when non-generic and generics were interleaved) in the generic lambda world - that I somewhat kludged around initially - but this resulted in PR17476.

The new approach seems cleaner. We only do the transformation of the TypeSourceInfo - but we make sure to do it in the current instantiation scope so we don't lose the untransformed to transformed mappings of the ParmVarDecls when they get created.

Another attempt caused a test to fail (http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20131021/091533.html) and also had to be reverted - my apologies - in my haste, i did not run all the tests - argh!

Now all the tests seem to pass - but a Fixme has been added - since I suspect Richard will find the fix a little inelegant ;) I shall try and work on a more elegant fix once I have had a chance to discuss with Richard or Doug at a later date.

Hopefully the third time;s a charm *fingers crossed*

This does not yet include capturing.

Please see test file for examples.

This patch was LGTM'd by Doug:
http://llvm-reviews.chandlerc.com/D1784



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193230 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.prim/expr.prim.lambda/generic-lambda-unimplemented-1y.cpp
80f2b2e693422f84ec3735f16a08614a527b0bc5 23-Oct-2013 Rafael Espindola <rafael.espindola@gmail.com> Revert r193223 and r193216.

They were causing CodeGenCXX/mangle-exprs.cpp to fail.

Revert "Remove the circular reference to LambdaExpr in CXXRecordDecl."

Revert "Again: Teach TreeTransform and family how to transform generic lambdas nested within templates and themselves."

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193226 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.prim/expr.prim.lambda/generic-lambda-unimplemented-1y.cpp
b814a2ac581f7aa31aeef1abb8567ea123a13519 23-Oct-2013 Faisal Vali <faisalv@yahoo.com> Again: Teach TreeTransform and family how to transform generic
lambdas nested within templates and themselves.

A previous attempt http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20130930/090049.html resulted in PR 17476, and was reverted,


The original TransformLambdaExpr (pre generic-lambdas) transformed the TypeSourceInfo of the Call operator in its own instantiation scope via TransformType. This resulted in the parameters of the call operator being mapped to their transformed counterparts in an instantiation scope that would get popped off.
Then a call to TransformFunctionParameters would add the parameters and their transformed mappings (but newly created ones!) to the current instantiation scope. This would result in a disconnect between the new call operator's TSI parameters and those used to construct the call operator declaration. This was ok in the non-generic lambda world - but would cause issues with nested transformations (when non-generic and generics were interleaved) in the generic lambda world - that I somewhat kludged around initially - but this resulted in PR17476.

The new approach seems cleaner. We only do the transformation of the TypeSourceInfo - but we make sure to do it in the current instantiation scope so we don't lose the untransformed to transformed mappings of the ParmVarDecls when they get created.

This does not yet include capturing.

Please see test file for examples.

This patch was LGTM'd by Doug:
http://llvm-reviews.chandlerc.com/D1784


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193216 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.prim/expr.prim.lambda/generic-lambda-unimplemented-1y.cpp
730a2c2f915d81f6cdb53918d8b155ee25b8175f 11-Oct-2013 Douglas Gregor <dgregor@apple.com> Diagnose by-copy captures of abstract classes.

Fixes <rdar://problem/14468891>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@192419 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.prim/expr.prim.lambda/p14.cpp
eeac7a4bb4bf6b2bf423ec84eabcf179b9d7e4ea 09-Oct-2013 David Majnemer <david.majnemer@gmail.com> Make wording for certain invalid unary expressions more consistent.

An invalid decltype expression like 'decltype int' gives:
error: expected '(' after 'decltype'

This makes it so 'sizeof int' gives a similar one:
error: expected parentheses around type name in sizeof expression


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@192258 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.unary/expr.sizeof/p1.cpp
2e391e516c70c64457c009574de18d0a29ca42b6 08-Oct-2013 Serge Pavlov <sepavloff@gmail.com> Fixed messages in tests.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@192208 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.unary/expr.sizeof/p1.cpp
2a0a49612ec8866fe2e75b1e0aab04326861b5f2 08-Oct-2013 Serge Pavlov <sepavloff@gmail.com> Add fixits suggesting parenthesis around type name in expressions like sizeof.
This fixes PR16992 - Fixit missing when "sizeof type" found.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@192200 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.unary/expr.sizeof/p1.cpp
f003acd8e7bdb994743dc8ea64f90db5360a8b4a 04-Oct-2013 Rafael Espindola <rafael.espindola@gmail.com> Revert "Teach TreeTransform and family how to transform generic lambdas within templates and nested within themselves."

This reverts commit r191879. It caused llvm.org/pr17476.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191955 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.prim/expr.prim.lambda/generic-lambda-unimplemented-1y.cpp
618c28547a7f7cc785a6c6301f79febf5a584f9e 03-Oct-2013 Faisal Vali <faisalv@yahoo.com> Teach TreeTransform and family how to transform generic lambdas within templates and nested within themselves.

This does not yet include capturing (that is next).

Please see test file for examples.

This patch was LGTM'd by Doug:
http://llvm-reviews.chandlerc.com/D1784
http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20130930/090048.html

When I first committed this patch - a bunch of buildbots were unable to compile the code that VS2010 seemed to compile. Seems like there was a dependency on Sema/Template.h which VS did not seem to need, but I have now added for the other compilers. It still compiles on Visual Studio 2010 - lets hope the buildbots remain quiet (please!)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191879 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.prim/expr.prim.lambda/generic-lambda-unimplemented-1y.cpp
9683f1de5f8eb3a4dd7c7fcb4ff58033b9cfa46f 03-Oct-2013 Faisal Vali <faisalv@yahoo.com> Revert changes from the nested lambdas commit till i figure out
why the buildbots are failing.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191876 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.prim/expr.prim.lambda/generic-lambda-unimplemented-1y.cpp
aecbb9de3bed4372695756f18af2c1304a81e7c4 03-Oct-2013 Faisal Vali <faisalv@yahoo.com> Teach TreeTransform and family how to transform generic lambdas within templates and nested within themselves.

This does not yet include capturing (that is next).

Please see test file for examples.

This patch was LGTM'd by Doug:
http://llvm-reviews.chandlerc.com/D1784


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191875 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.prim/expr.prim.lambda/generic-lambda-unimplemented-1y.cpp
d6992ab33b7113e1bd7af51c0c52d17c23706c01 29-Sep-2013 Faisal Vali <faisalv@yahoo.com> Implement conversion to function pointer for generic lambdas without captures.

The general strategy is to create template versions of the conversion function and static invoker and then during template argument deduction of the conversion function, create the corresponding call-operator and static invoker specializations, and when the conversion function is marked referenced generate the body of the conversion function using the corresponding static-invoker specialization. Similarly, Codegen does something similar - when asked to emit the IR for a specialized static invoker of a generic lambda, it forwards emission to the corresponding call operator.

This patch has been reviewed in person both by Doug and Richard. Richard gave me the LGTM.

A few minor changes:
- per Richard's request i added a simple check to gracefully inform that captures (init, explicit or default) have not been added to generic lambdas just yet (instead of the assertion violation).
- I removed a few lines of code that added the call operators instantiated parameters to the currentinstantiationscope. Not only did it not handle parameter packs, but it is more relevant in the patch for nested lambdas which will follow this one, and fix that problem more comprehensively.
- Doug had commented that the original implementation strategy of using the TypeSourceInfo of the call operator to create the static-invoker was flawed and allowed const as a member qualifier to creep into the type of the static-invoker. I currently kludge around it - but after my initial discussion with Doug, with a follow up session with Richard, I have added a FIXME so that a more elegant solution that involves the use of TrivialTypeSourceInfo call followed by the correct wiring of the template parameters to the functionprototypeloc is forthcoming.

Thanks!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191634 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.prim/expr.prim.lambda/generic-lambda-unimplemented-1y.cpp
9beaf20b882eb83082da27a74760277bb9fc0bdd 28-Sep-2013 Richard Smith <richard-llvm@metafoo.co.uk> Add compat/extension warnings for init captures.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191609 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.prim/expr.prim.lambda/p23.cpp
xpr.prim/expr.prim.lambda/p8.cpp
04fa7a33279808dc3e5117c41b5f84c40eeb7362 28-Sep-2013 Richard Smith <richard-llvm@metafoo.co.uk> Per latest drafting, switch to implementing init-captures as if by declaring
and capturing a variable declaration, and complete the implementation of them.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191605 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.prim/expr.prim.lambda/p11-1y.cpp
xpr.prim/expr.prim.lambda/p23.cpp
473f8b2f5453189406e0dc6e623abb1c7b6f24be 27-Sep-2013 Faisal Vali <faisalv@yahoo.com> Fix the test files by removing the unnecessary -emit-llvm flag (should address Matt Beaumont-Gay's concern regarding failure on a read-only filesystem)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191531 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.prim/expr.prim.lambda/generic-lambda-unimplemented-1y.cpp
xpr.prim/expr.prim.lambda/p5-generic-lambda-1y.cpp
fad9e13f3cb85198f0ee5af620ba81cd78574faa 26-Sep-2013 Faisal Vali <faisalv@yahoo.com> Implement a rudimentary form of generic lambdas.

Specifically, the following features are not included in this commit:
- any sort of capturing within generic lambdas
- generic lambdas within template functions and nested
within other generic lambdas
- conversion operator for captureless lambdas
- ensuring all visitors are generic lambda aware
(Although I have gotten some useful feedback on my patches of the above and will be incorporating that as I submit those patches for commit)

As an example of what compiles through this commit:

template <class F1, class F2>
struct overload : F1, F2 {
using F1::operator();
using F2::operator();
overload(F1 f1, F2 f2) : F1(f1), F2(f2) { }
};

auto Recursive = [](auto Self, auto h, auto ... rest) {
return 1 + Self(Self, rest...);
};
auto Base = [](auto Self, auto h) {
return 1;
};
overload<decltype(Base), decltype(Recursive)> O(Base, Recursive);
int num_params = O(O, 5, 3, "abc", 3.14, 'a');

Please see attached tests for more examples.

This patch has been reviewed by Doug and Richard. Minor changes (non-functionality affecting) have been made since both of them formally looked at it, but the changes involve removal of supernumerary return type deduction changes (since they are now redundant, with richard having committed a recent patch to address return type deduction for C++11 lambdas using C++14 semantics).



Some implementation notes:

- Add a new Declarator context => LambdaExprParameterContext to
clang::Declarator to allow the use of 'auto' in declaring generic
lambda parameters

- Add various helpers to CXXRecordDecl to facilitate identifying
and querying a closure class

- LambdaScopeInfo (which maintains the current lambda's Sema state)
was augmented to house the current depth of the template being
parsed (id est the Parser calls Sema::RecordParsingTemplateParameterDepth)
so that SemaType.cpp::ConvertDeclSpecToType may use it to immediately
generate a template-parameter-type when 'auto' is parsed in a generic
lambda parameter context. (i.e we do NOT use AutoType deduced to
a template parameter type - Richard seemed ok with this approach).
We encode that this template type was generated from an auto by simply
adding $auto to the name which can be used for better diagnostics if needed.

- SemaLambda.h was added to hold some common lambda utility
functions (this file is likely to grow ...)

- Teach Sema::ActOnStartOfFunctionDef to check whether it
is being called to instantiate a generic lambda's call
operator, and if so, push an appropriately prepared
LambdaScopeInfo object on the stack.

- various tests were added - but much more will be needed.

There is obviously more work to be done, and both Richard (weakly) and Doug (strongly)
have requested that LambdaExpr be removed form the CXXRecordDecl LambdaDefinitionaData
in a future patch which is forthcoming.

A greatful thanks to all reviewers including Eli Friedman, James Dennett,
and especially the two gracious wizards (Richard Smith and Doug Gregor)
who spent hours providing feedback (in person in Chicago and on the mailing lists).
And yet I am certain that I have allowed unidentified bugs to creep in; bugs, that I will do my best to slay, once identified!

Thanks!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191453 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.prim/expr.prim.lambda/generic-lambda-unimplemented-1y.cpp
xpr.prim/expr.prim.lambda/p2-generic-lambda-1y.cpp
xpr.prim/expr.prim.lambda/p4-1y.cpp
xpr.prim/expr.prim.lambda/p4.cpp
xpr.prim/expr.prim.lambda/p5-generic-lambda-1y.cpp
4d4032206c9f966d991c73000e8816b910fb2fd7 02-Sep-2013 Chandler Carruth <chandlerc@gmail.com> Mark that qualifiers can prefix the auto type. This seems to just have
been an oversight, as it definitely works. Every test which changed had
the const written on the LHS of the auto already.

Notably, this also makes things like cpp11-migrate's formation of 'const
auto &' variables much more familiar.

Yes, many people feel that 'const' and other qualifiers belong on the
RHS of the type. I'm not going to argue about that because Clang already
*overwhelming* places the qualifiers on the LHS when it can and on the
RHS when it must. We shouldn't diverge for auto. We should add a tool to
clang-tidy that fixes this in either direction, and then wire up
clang-tidy to tools like cpp11-migrate to fix their placement after
transforms.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@189769 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.unary/expr.new/p2-cxx0x.cpp
152b4e4652baedfceba1cd8115515629225e713f 22-Aug-2013 Manuel Klimek <klimek@google.com> Revert "Implement a rudimentary form of generic lambdas."

This reverts commit 606f5d7a99b11957e057e4cd1f55f931f66a42c7.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@189004 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.prim/expr.prim.lambda/generic-lambda-unimplemented-1y.cpp
xpr.prim/expr.prim.lambda/p2-generic-lambda-1y.cpp
xpr.prim/expr.prim.lambda/p4-1y.cpp
xpr.prim/expr.prim.lambda/p4.cpp
xpr.prim/expr.prim.lambda/p5-generic-lambda-1y.cpp
ecb5819a9e64fb654d46a3b270a286cc570c58ff 22-Aug-2013 Faisal Vali <faisalv@yahoo.com> Implement a rudimentary form of generic lambdas.

Specifically, the following features are not included in this commit:
- any sort of capturing within generic lambdas
- nested lambdas
- conversion operator for captureless lambdas
- ensuring all visitors are generic lambda aware


As an example of what compiles:

template <class F1, class F2>
struct overload : F1, F2 {
using F1::operator();
using F2::operator();
overload(F1 f1, F2 f2) : F1(f1), F2(f2) { }
};

auto Recursive = [](auto Self, auto h, auto ... rest) {
return 1 + Self(Self, rest...);
};
auto Base = [](auto Self, auto h) {
return 1;
};
overload<decltype(Base), decltype(Recursive)> O(Base, Recursive);
int num_params = O(O, 5, 3, "abc", 3.14, 'a');

Please see attached tests for more examples.

Some implementation notes:

- Add a new Declarator context => LambdaExprParameterContext to
clang::Declarator to allow the use of 'auto' in declaring generic
lambda parameters

- Augment AutoType's constructor (similar to how variadic
template-type-parameters ala TemplateTypeParmDecl are implemented) to
accept an IsParameterPack to encode a generic lambda parameter pack.

- Add various helpers to CXXRecordDecl to facilitate identifying
and querying a closure class

- LambdaScopeInfo (which maintains the current lambda's Sema state)
was augmented to house the current depth of the template being
parsed (id est the Parser calls Sema::RecordParsingTemplateParameterDepth)
so that Sema::ActOnLambdaAutoParameter may use it to create the
appropriate list of corresponding TemplateTypeParmDecl for each
auto parameter identified within the generic lambda (also stored
within the current LambdaScopeInfo). Additionally,
a TemplateParameterList data-member was added to hold the invented
TemplateParameterList AST node which will be much more useful
once we teach TreeTransform how to transform generic lambdas.

- SemaLambda.h was added to hold some common lambda utility
functions (this file is likely to grow ...)

- Teach Sema::ActOnStartOfFunctionDef to check whether it
is being called to instantiate a generic lambda's call
operator, and if so, push an appropriately prepared
LambdaScopeInfo object on the stack.

- Teach Sema::ActOnStartOfLambdaDefinition to set the
return type of a lambda without a trailing return type
to 'auto' in C++1y mode, and teach the return type
deduction machinery in SemaStmt.cpp to process either
C++11 and C++14 lambda's correctly depending on the flag.

- various tests were added - but much more will be needed.

A greatful thanks to all reviewers including Eli Friedman,
James Dennett and the ever illuminating Richard Smith. And
yet I am certain that I have allowed unidentified bugs to creep in;
bugs, that I will do my best to slay, once identified!

Thanks!




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@188977 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.prim/expr.prim.lambda/generic-lambda-unimplemented-1y.cpp
xpr.prim/expr.prim.lambda/p2-generic-lambda-1y.cpp
xpr.prim/expr.prim.lambda/p4-1y.cpp
xpr.prim/expr.prim.lambda/p4.cpp
xpr.prim/expr.prim.lambda/p5-generic-lambda-1y.cpp
c99b90edb85ea0a5be6ce567a8c0147b76534e15 14-Aug-2013 Eli Friedman <eli.friedman@gmail.com> sizeof(void) etc. should be a hard error in C++.

PR16872.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@188324 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.post/expr.call/p7-0x.cpp
xpr.prim/expr.prim.lambda/p2.cpp
xpr.unary/expr.sizeof/p1.cpp
0e2189791acf7fcec4f1b32af24efb2d363f30c1 05-Aug-2013 Richard Smith <richard-llvm@metafoo.co.uk> Implement C++'s restrictions on the type of an expression passed to a vararg
function: it can't be 'void' and it can't be an initializer list. We give a
hard error for these rather than treating them as undefined behavior (we can
and probably should do the same for non-POD types in C++11, but as of this
change we don't).

Slightly rework the checking of variadic arguments in a function with a format
attribute to ensure that certain kinds of format string problem (non-literal
string, too many/too few arguments, ...) don't suppress this error.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@187735 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.post/expr.call/p7-0x.cpp
14d937afc2ad8f65dccbafeb62271e80dbd46a78 27-Jul-2013 Richard Smith <richard-llvm@metafoo.co.uk> Handle a difference in lambda return type deduction between C++11 and C++1y: if
no return type is specified, C++11 will deduce a cv-qualified return type in
some cases, but C++1y never will.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@187275 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.prim/expr.prim.lambda/p4.cpp
4384712b3a0aedd7c68d6abdb0407850f7b46c8b 20-Jul-2013 Larisse Voufo <lvoufo@google.com> FIXME fix: improving diagnostics for template arguments deduction of class templates and explicit specializations
This patch essentially removes all the FIXMEs following calls to DeduceTemplateArguments() that want to keep track of deduction failure info.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186730 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.const/p3-0x.cpp
8c5d4078bb40642847164e7613828262d32db973 20-Jul-2013 Larisse Voufo <lvoufo@google.com> Revert "Use function overloading instead of template specialization for diagnosis of bad template argument deductions."

This reverts commit a730f548325756d050d4caaa28fcbffdae8dfe95.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186729 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.const/p3-0x.cpp
a730f548325756d050d4caaa28fcbffdae8dfe95 20-Jul-2013 Larisse Voufo <lvoufo@google.com> Use function overloading instead of template specialization for diagnosis of bad template argument deductions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186727 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.const/p3-0x.cpp
8443188a8f9cbd27612b7058cdcfc53356f024a3 02-Jul-2013 Eli Friedman <eli.friedman@gmail.com> More fixes for block mangling.

Make sure we properly treat names defined inside a block as local
names. There are basically three fixes here. One, correctly
treat blocks as a context where we need to use local-name mangling using
the new isLocalContainerContext helper. Two, make
CXXNameMangler::manglePrefix handle local names in a consistent way.
Three, extend CXXNameMangler::mangleLocalName so it can mangle a block
correctly.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185450 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.prim/expr.prim.lambda/blocks-irgen.mm
1cf7c3f8948b26395bc3293a657afb9f98878db7 02-Jul-2013 Eli Friedman <eli.friedman@gmail.com> Don't skip lambdas when mangling local vars.

This commit rearranges the logic in CXXNameMangler::mangleLocalName and
GetLocalClassDecl so that it doesn't accidentally skip over lambdas. It
also reduces code duplication a bit.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185402 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.prim/expr.prim.lambda/blocks-irgen.mm
07369dde9d72213bf8a48288cd8b29999af9a40c 01-Jul-2013 Eli Friedman <eli.friedman@gmail.com> Fix mangling for block literals.

Blocks, like lambdas, can be written in contexts which are required to be
treated as the same under ODR. Unlike lambdas, it isn't possible to actually
take the address of a block, so the mangling of the block itself doesn't
matter. However, objects like static variables inside a block do need to
be mangled in a consistent way.

There are basically three components here. One, block literals need a
consistent numbering. Two, objects/types inside a block literal need
to be mangled using it. Three, objects/types inside a block literal need
to have their linkage computed correctly.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185372 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.prim/expr.prim.lambda/blocks-irgen.mm
f9b4fea4bf6cebe614e49ab4b582dcf4bf0a6806 25-Jun-2013 Eli Friedman <eli.friedman@gmail.com> Fix regression from r184810.

Specifically, CallExpr::getCalleeDecl() can return null, so make sure to
handle that correctly.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184813 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.unary/expr.unary.noexcept/sema.cpp
72aa4c431b650800140457636c8481fd965f1534 25-Jun-2013 Eli Friedman <eli.friedman@gmail.com> Fix noexcept for delete expressions.

Using "delete" on a pointer to an incomplete type can't throw.
While I'm here, clean up the signature of the canCalleeThrow() helper.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184810 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.unary/expr.unary.noexcept/sema.cpp
bace10ccf5fe3468c6232681875039961f02322d 24-Jun-2013 Eli Friedman <eli.friedman@gmail.com> Change mangling of objects inside block literals.

This changes the mangling of local static variables/etc. inside blocks
to do something simple and sane. This avoids depending on the way we mangle
blocks, which isn't really appropriate here.

John, please take a look at this to make sure the mangling I chose is sane.

Fixes <rdar://problem/14074423>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184780 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.prim/expr.prim.lambda/blocks-irgen.mm
d6b698739ab157348acafcec5b06a05d3d35377d 15-Jun-2013 Richard Smith <richard-llvm@metafoo.co.uk> PR16263: Implement current direction of core issue 1376. Binding a reference to
the result of a cast-to-reference-type lifetime-extends the object to which the
reference inside the cast binds.

This requires us to look for subobject adjustments on both the inside and the
outside of the MaterializeTemporaryExpr when looking for a temporary to
lifetime-extend (which we also need for core issue 616, and possibly 1213).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184024 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.prim/expr.prim.lambda/p11-1y.cpp
41cb3d90c2114a7df7aa04f80c8be4b62994fb0d 15-Jun-2013 Richard Smith <richard-llvm@metafoo.co.uk> Fix handling of const_cast from prvalue to rvalue reference: such a cast is
only permitted if the source object is of class type, and should materialize a
temporary for the reference to bind to.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184017 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.const/p2-0x.cpp
xpr.post/expr.const.cast/p1-0x.cpp
ddb5a3926d715ab4354ca36117679e3f4d5d3e21 14-Jun-2013 Eli Friedman <eli.friedman@gmail.com> Unify return type checking for functions and ObjC methods. Move all the
random checks for ObjC object return types to SemaType.cpp.

Fixes issue with ObjC method type checking reported on cfe-dev.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184006 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.prim/expr.prim.lambda/p4.mm
01e0b1f24af250da37faf953cd82626b360622f6 11-Jun-2013 David Majnemer <david.majnemer@gmail.com> Implement DR61: Address of ambiguous bound methods should be disallowed

DR61 affirms that expressions containing unresolved member access should
be disallowed when performing "address of" operations.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183723 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.unary/expr.unary.op/p4.cpp
cafeb948e6067b8dc897c441da522367917b06f9 07-Jun-2013 Richard Smith <richard-llvm@metafoo.co.uk> PR16243: Use CXXThisOverride during template instantiation, and fix up the
places which weren't setting it up properly. This allows us to get the right
cv-qualifiers for 'this' when it appears outside a method body in a class
template.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183483 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.prim/expr.prim.general/p3-0x.cpp
8a66bf78becf05a24e8251379f3843d1fceb627f 03-Jun-2013 Richard Smith <richard-llvm@metafoo.co.uk> Refactor constant expression evaluation to associate the complete object of a
materialized temporary with the corresponding MaterializeTemporaryExpr. This is
groundwork for providing C++11's guaranteed static initialization for global
references bound to lifetime-extended temporaries (if the initialization is a
constant expression).

In passing, fix a couple of bugs where some evaluation failures didn't trigger
diagnostics, and a rejects-valid where potential constant expression testing
would assume that it knew the dynamic type of *this and would reject programs
which relied on it being some derived type.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183093 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.const/p2-0x.cpp
0d8e9646bc000bab521ce52ed294209a92298cef 16-May-2013 Richard Smith <richard-llvm@metafoo.co.uk> First pass of semantic analysis for init-captures: check the initializer, build
a FieldDecl from it, and propagate both into the closure type and the
LambdaExpr.

You can't do much useful with them yet -- you can't use them within the body
of the lambda, because we don't have a representation for "the this of the
lambda, not the this of the enclosing context". We also don't have support or a
representation for a nested capture of an init-capture yet, which was intended
to work despite not being allowed by the current standard wording.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181985 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.prim/expr.prim.lambda/p11-1y.cpp
xpr.prim/expr.prim.lambda/p23.cpp
xpr.prim/expr.prim.lambda/p8.cpp
f45c2992a3aac7591310cd824b7c7319afd432fc 12-May-2013 Richard Smith <richard-llvm@metafoo.co.uk> C++1y: provide full 'auto' return type deduction for lambda expressions. This
completes the implementation of N3638.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181669 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.prim/expr.prim.lambda/p4-1y.cpp
xpr.prim/expr.prim.lambda/p4.cpp
993f43f24d7a45a5cd4678a3316b0852261fc5d4 06-May-2013 John McCall <rjmccall@apple.com> Grab-bag of bit-field fixes:

- 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
xpr.post/expr.const.cast/p1-0x.cpp
xpr.unary/expr.sizeof/p1.cpp
840462670ba7a6bc26265a2306b35f2f0f01f51c 21-Apr-2013 Richard Smith <richard-llvm@metafoo.co.uk> The 'constexpr implies const' rule for non-static member functions is gone in
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
xpr.ass/p9-cxx11.cpp
xpr.const/p2-0x.cpp
xpr.const/p3-0x.cpp
xpr.const/p5-0x.cpp
7974c60375b2b9dfc20defc77c9ed8c3d6d241a1 17-Apr-2013 Richard Smith <richard-llvm@metafoo.co.uk> DR974: Lambdas can have default arguments.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179688 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.prim/expr.prim.lambda/default-arguments.cpp
xpr.prim/expr.prim.lambda/p5.cpp
e79ce292d93f955c1219c3977c02199bd3dc6544 26-Mar-2013 Douglas Gregor <dgregor@apple.com> <rdar://problem/13473493> Handle 'this->' insertion recovery within trailing return types.




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178081 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.prim/expr.prim.general/p3-0x.cpp
d92277928eefcf958080707ed6e154f406a5d054 15-Mar-2013 Richard Smith <richard-llvm@metafoo.co.uk> PR15290: 'this' is not permitted in the declaration of a friend function,
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
xpr.prim/expr.prim.general/p3-0x.cpp
f727e1c6cc382c1b5fe23b38ba04df2d4a2f358a 29-Jan-2013 Douglas Gregor <dgregor@apple.com> Don't crash while printing APValues that are lvalues casted to a
decidedly non-reference, non-pointer type. Fixes <rdar://problem/13090123>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173747 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.const/p2-0x.cpp
cd8ab51a44e80625d84126780b0d85a7732e25af 17-Jan-2013 Richard Smith <richard-llvm@metafoo.co.uk> Implement C++11 semantics for [[noreturn]] attribute. This required splitting
it apart from [[gnu::noreturn]] / __attribute__((noreturn)), since their
semantics are not equivalent (for instance, we treat [[gnu::noreturn]] as
affecting the function type, whereas [[noreturn]] does not).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172691 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.prim/expr.prim.lambda/p5.cpp
xpr.prim/expr.prim.lambda/templates.cpp
0f46e64947bdd570a499732c4b459961627d8745 28-Dec-2012 Richard Smith <richard-llvm@metafoo.co.uk> Improve diagnostic wording for when an implicitly-deleted special member
function is selected by overload resolution.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171190 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.prim/expr.prim.lambda/p19.cpp
1a6c43a9d215697dbe0418c145a6bd1c85ec654d 22-Nov-2012 Richard Smith <richard-llvm@metafoo.co.uk> Test that we correctly deal with multiple copy constructors when detecting
non-trivial special members for varargs calls.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168476 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.post/expr.call/p7-0x.cpp
f64231e9f47234826fbcdc3b4fe0370ef6c9961d 06-Nov-2012 Michael Han <Michael.Han@autodesk.com> Teach Clang parser to reject C++11 attributes that appertain to declaration specifiers.

We don't support any C++11 attributes that appertain to declaration specifiers so reject
the attributes in parser until we support them; this also conforms to what g++ 4.8 is doing.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167481 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.const/p5-0x.cpp
c3f1742bdd1ae0091d51168e111cd63861587b13 25-Oct-2012 Douglas Gregor <dgregor@apple.com> When capturing 'this' in a lambda, make sure to update the set of
array-index starting values for the 'this' capture. Fixes
<rdar://problem/12426831>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166709 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.prim/expr.prim.lambda/p14.cpp
8e8fb3be5bd78f0564444eca02b404566a5f3b5d 19-Oct-2012 Andy Gibbs <andyg1001@hotmail.co.uk> Prior to adding the new "expected-no-diagnostics" directive to VerifyDiagnosticConsumer, make the necessary adjustment to 580 test-cases which will henceforth require this new directive.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166280 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.cast/p4-0x.cpp
xpr.const/p3-0x-nowarn.cpp
xpr.post/expr.const.cast/p1-0x.cpp
xpr.post/expr.ref/p3.cpp
xpr.post/expr.static.cast/p3-0x.cpp
xpr.post/expr.static.cast/p9-0x.cpp
xpr.post/expr.type.conv/p1-0x.cpp
xpr.prim/expr.prim.lambda/p15.cpp
xpr.prim/expr.prim.lambda/p18.cpp
xpr.prim/expr.prim.lambda/p20.cpp
xpr.prim/expr.prim.lambda/p21.cpp
xpr.unary/expr.unary.noexcept/sema.cpp
xpr.unary/expr.unary.op/p3.cpp
8.cpp
9.cpp
4a529d26d6ccfc9b3d11031f1256f4f87055c562 19-Oct-2012 Andy Gibbs <andyg1001@hotmail.co.uk> Fix directive parsing in VerifyDiagnosticConsumer so that it ensures that "expected" is at the start of the word and will no longer accept typos such as "junkexpected-*" as a valid "expected-*" directive. A very few test-cases had to be amended to adhere to the new rule.

Patch reviewed by David Blaikie.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166279 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.prim/expr.prim.general/p3-0x.cpp
2bcb984df975c75130f2320c935fae1143c2a5cc 14-Sep-2012 Richard Smith <richard-llvm@metafoo.co.uk> Revert r163829. The world (or libstdc++, at least) is not ready.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163846 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.const/p3-0x.cpp
ceb07622bacde3184b19caf0957f5eeba5cb6784 13-Sep-2012 Richard Smith <richard-llvm@metafoo.co.uk> Remove speculative fix for C++ core issue 1407, since it was resolved as NAD.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163829 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.const/p3-0x.cpp
612409ece080e814f79e06772c690d603f45fbd6 25-Jul-2012 Richard Smith <richard-llvm@metafoo.co.uk> PR12057: Allow variadic template pack expansions to cross lambda boundaries.
Rather than adding a ContainsUnexpandedParameterPack bit to essentially every
AST node, we tunnel the bit directly up to the surrounding lambda expression
when we reach a context where an unexpanded pack can not normally appear.
Thus any statement or declaration within a lambda can now potentially contain
an unexpanded parameter pack.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160705 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.prim/expr.prim.lambda/blocks.mm
xpr.prim/expr.prim.lambda/p23.cpp
26dc97cbeba8ced19972a259720a71aefa01ef43 17-Jul-2012 Eli Friedman <eli.friedman@gmail.com> Don't treat overflow in floating-point conversions as a hard error in constant evaluation. <rdar://problem/11874571>.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160394 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.const/p2-0x.cpp
4904bf4e84cfb48080270ebaa9005327f18ab0e5 26-Jun-2012 Fariborz Jahanian <fjahanian@apple.com> block literal irgen: several improvements on naming block
literal helper functions. All helper functions (global
and locals) use block_invoke as their prefix. Local literal
helper names are prefixed by their enclosing mangled function
names. Blocks in non-local initializers (e.g. a global variable
or a C++11 field) are prefixed by their mangled variable name.
The descriminator number added to end of the name starts off
with blank (for first block) and _<N> (for the N+2-th block).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159206 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.prim/expr.prim.lambda/blocks-irgen.mm
03f1eb031b84e93415b792c4b45d8da71c88e92d 15-Jun-2012 Douglas Gregor <dgregor@apple.com> Check the parameter lists and return type of both blocks and lambdas
for unexpanded parameter packs. Fixes the crash-on-invalid in
PR13117.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158525 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.prim/expr.prim.lambda/blocks.mm
287698336ff9f9315bf814943068d6b8261e517d 04-Jun-2012 Aaron Ballman <aaron@aaronballman.com> Fixes some test cases that should have come along with r157943.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@157947 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.prim/expr.prim.lambda/p4.cpp
e26073c85259be1c2f397797cc59286ac85fb3b8 25-May-2012 Eli Friedman <eli.friedman@gmail.com> Implement the C++11 discarded value expression rules for volatile lvalues. <rdar://problem/10790820>.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@157420 91177308-0d34-0410-b5e6-96231b3b80d8
10-0x.cpp
d57f52ca4d0e9d5d42dd6947d1e66d693625cf2c 16-May-2012 Douglas Gregor <dgregor@apple.com> Clean up r156925, so that we only mark the capturing DeclRefExpr of a
lambda as referring to a local in an enclosing scope if we're in the
enclosing scope of the lambda (not it's function call operator). Also,
turn the test into an IR generation test, since that's where the
crashes occurred. Really fixes PR12746 / <rdar://problem/11465120>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156926 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.prim/expr.prim.lambda/blocks-irgen.mm
xpr.prim/expr.prim.lambda/blocks.mm
29a93f810ae5277446f610e8b6cdf0985febb989 16-May-2012 Douglas Gregor <dgregor@apple.com> Fix code generation of variables reference expressions when mixing
blocks and lambdas, based heavily on a patch from Meador Inge. Fixes
PR12746 / <rdar://problem/11465120>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156925 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.prim/expr.prim.lambda/blocks.mm
be0ee875d8a91c031a085cbbd73ad9e8dc1aa8ff 15-May-2012 David Blaikie <dblaikie@gmail.com> Improve some of the conversion warnings to fire on conversion to bool.

Moves the bool bail-out down a little in SemaChecking - so now
-Wnull-conversion and -Wliteral-conversion can fire when the target type is
bool.

Also improve the wording/details in the -Wliteral-conversion warning to match
the -Wconstant-conversion.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156826 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.unary/expr.unary.op/p6.cpp
6deb820a1d2f98e8eda7df1da057cecce8655289 02-May-2012 Richard Smith <richard-llvm@metafoo.co.uk> Disable our non-standard delayed parsing of exception specifications. Delaying
the parsing of such things appears to be a conforming extension, but it breaks
libstdc++4.7's std::pair.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155975 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.prim/expr.prim.general/p3-0x.cpp
6850fafd27ba804d4d4ca8af404beed5574e3749 29-Apr-2012 Richard Smith <richard-llvm@metafoo.co.uk> PR9546, DR1268: A prvalue cannot be reinterpret_cast to an rvalue reference
type. But a glvalue can be reinterpret_cast to either flavor of reference.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155789 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.post/expr.reinterpret.cast/p1-0x.cpp
74e2fc332e07c76d4e69ccbd0e9e47a0bafd3908 16-Apr-2012 Douglas Gregor <dgregor@apple.com> Implement the last part of C++ [class.mem]p2, delaying the parsing of
exception specifications on member functions until after the closing
'}' for the containing class. This allows, for example, a member
function to throw an instance of its own class. Fixes PR12564 and a
fairly embarassing oversight in our C++98/03 support.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154844 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.prim/expr.prim.general/p3-0x.cpp
cefc3afac14d29de5aba7810cc8fe6c858949e9d 16-Apr-2012 Douglas Gregor <dgregor@apple.com> Implement C++11 [expr.prim.general]p3, which permits the use of 'this'
in the declaration of a non-static member function after the
(optional) cv-qualifier-seq, which in practice means in the exception
specification and late-specified return type.

The new scheme here used to manage 'this' outside of a member function
scope is more general than the Scope-based mechanism previously used
for non-static data member initializers and late-parsesd attributes,
because it can also handle the cv-qualifiers on the member
function. Note, however, that a separate pass is required for static
member functions to determine whether 'this' was used, because we
might not know that we have a static function until after declaration
matching.

Finally, this introduces name mangling for 'this' and for the implicit
'this', which is intended to match GCC's mangling. Independent
verification for the new mangling test case would be appreciated.

Fixes PR10036 and PR12450.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154799 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.prim/expr.prim.general/p3-0x.cpp
a85cf39786fffd6860a940523be01eb02a4935c0 05-Apr-2012 Richard Smith <richard-llvm@metafoo.co.uk> Improve diagnostics for invalid use of non-static members / this:

* s/nonstatic/non-static/ in the diagnostics, since the latter form outvoted
the former by 28-2 in our diagnostics.
* Fix the "use of member in static member function" diagnostic to correctly
detect this situation inside a block or lambda.
* Produce a more specific "invalid use of non-static member" diagnostic for
the case where a nested class member refers to a member of a
lexically-surrounding class.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154073 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.prim/expr.prim.general/p12-0x.cpp
xpr.prim/expr.prim.general/p4-0x.cpp
xpr.prim/expr.prim.lambda/p12.cpp
1ef28dbcf1a8b72f590f2d73bc204e85605ab605 30-Mar-2012 Eli Friedman <eli.friedman@gmail.com> Extend -Wc++11-narrowing to cover converted constant expressions as well as braced-initializers. <rdar://problem/11121178>.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153703 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.const/p3-0x-nowarn.cpp
426d6ca163e20187761aa55a67797dac51508d0d 11-Mar-2012 David Blaikie <dblaikie@gmail.com> Fix crash & accepts-invalid for array of arrays of user defined type.

Test case/other help by Richard Smith.
Code review by John McCall.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152519 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.unary/expr.new/p17-crash.cpp
xpr.unary/expr.new/p17.cpp
16581335fc32abcbc6ab14eda7af38cf759664b7 02-Mar-2012 Richard Smith <richard-llvm@metafoo.co.uk> Ensure that we instantiate static reference data members of class templates
early, since their values can be used in constant expressions in C++11. For
odr-use checking, the opposite change is required, since references are
odr-used whether or not they satisfy the requirements for appearing in a
constant expression.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151881 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.const/p2-0x.cpp
5e4e58b805e0e03a669aa517d1d20d4735a3192e 01-Mar-2012 Richard Smith <richard-llvm@metafoo.co.uk> Reject 'a = {0} = {0}' rather than parsing it as '(a = {0}) = {0}'. Also
improve the diagnostics for some attempts to use initializer lists in
expressions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151794 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.ass/p9-cxx11.cpp
ac6260187b6b2f26faa9264d170d649a501f58a9 29-Feb-2012 Eli Friedman <eli.friedman@gmail.com> Make the odr-use logic work correctly for constant-expressions. PR12006.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151699 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.prim/expr.prim.lambda/p12.cpp
0d8ab2ed4b7555b6fde965238222e5099614d7bb 27-Feb-2012 Sebastian Redl <sebastian.redl@getdesigned.at> Convert initializer lists to temporaries in CreateBuiltinBinOp. Allows assignment of init lists to built-in types and resolves PR12088.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151551 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.ass/p9-cxx11.cpp
dbe01bb024ce9407954275a5e3c7e1a7113ca9fa 27-Feb-2012 Richard Smith <richard-llvm@metafoo.co.uk> Tests for r151508.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151509 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.ass/p9-cxx11.cpp
2c8aee454dac03e4918f0bb6e7fb849953056aba 25-Feb-2012 Richard Smith <richard-llvm@metafoo.co.uk> PR11956: C++11's special exception for accessing non-static data members from
unevaluated operands applies within member functions, too.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151443 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.prim/expr.prim.general/p12-0x.cpp
b734e2437d3c4b20a28b448e75cb45ef71f0b518 22-Feb-2012 Douglas Gregor <dgregor@apple.com> Teach overload resolution to prefer user-defined conversion via a
lambda closure type's function pointer conversion over user-defined
conversion via a lambda closure type's block pointer conversion,
always. This is a preference for more-standard code (since blocks
are an extension) and a nod to efficiency, since function pointers
don't require any memory management. Fixes PR12063.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151170 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.prim/expr.prim.lambda/blocks.mm
ac1303eca6cbe3e623fb5ec6fe7ec184ef4b0dfa 22-Feb-2012 Douglas Gregor <dgregor@apple.com> Generate an AST for the conversion from a lambda closure type to a
block pointer that returns a block literal which captures (by copy)
the lambda closure itself. Some aspects of the block literal are left
unspecified, namely the capture variable (which doesn't actually
exist) and the body (which will be filled in by IRgen because it can't
be written as an AST).

Because we're switching to this model, this patch also eliminates
tracking the copy-initialization expression for the block capture of
the conversion function, since that information is now embedded in the
synthesized block literal. -1 side tables FTW.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151131 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.prim/expr.prim.lambda/blocks.cpp
xpr.prim/expr.prim.lambda/blocks.mm
fccfb625e3090e77da9b6a79edcab159c7006685 21-Feb-2012 Douglas Gregor <dgregor@apple.com> In the conflict between C++11 [expr.prim.general]p4, which declares
that 'this' can be used in the brace-or-equal-initializer of a
non-static data member, and C++11 [expr.prim.lambda]p9, which says
that lambda expressions not in block scope can have no captures, side
fully with C++11 [expr.prim.general]p4 by allowing 'this' to be
captured within these initializers. This seems to be the intent of
non-static data member initializers.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151101 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.prim/expr.prim.general/p4-0x.cpp
f4b7de1cef3007cc0479775638198287384d9af1 21-Feb-2012 Douglas Gregor <dgregor@apple.com> Improve our handling of lambda expressions that occur within default
arguments. There are two aspects to this:

- Make sure that when marking the declarations referenced in a
default argument, we don't try to mark local variables, both because
it's a waste of time and because the semantics are wrong: we're not
in a place where we could capture these variables again even if it
did make sense.
- When a lambda expression occurs in a default argument of a
function template, make sure that the corresponding closure type is
considered dependent, so that it will get properly instantiated. The
second bit is a bit of a hack; to fix it properly, we may have to
rearchitect our handling of default arguments, parsing them only
after creating the function definition. However, I'd like to
separate that work from the lambdas work.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151076 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.prim/expr.prim.lambda/p13.cpp
999713eea940f4e087cc3ac878689c5c5c7a7225 18-Feb-2012 Douglas Gregor <dgregor@apple.com> Rewrite variable capture within lambda expressions and blocks,
eliminating a bunch of redundant code and properly modeling how the
captures of outside blocks/lambdas affect the types seen by inner
captures.

This new scheme makes two passes over the capturing scope stack. The
first pass goes up the stack (from innermost to outermost), assessing
whether the capture looks feasible and stopping when it either hits
the scope where the variable is declared or when it finds an existing
capture. The second pass then walks down the stack (from outermost to
innermost), capturing the variable at each step and updating the
captured type and the type that an expression referring to that
captured variable would see. It also checks type-specific
restrictions, such as the inability to capture an array within a
block. Note that only the first odr-use of each
variable needs to do the full walk; subsequent uses will find the
capture immediately, so multiple walks need not occur.

The same routine that builds the captures can also compute the type of
the captures without signaling errors and without actually performing
the capture. This functionality is used to determine the type of
declaration references as well as implementing the weird decltype((x))
rule within lambda expressions.

The capture code now explicitly takes sides in the debate over C++
core issue 1249, which concerns the type of captures within nested
lambdas. We opt to use the more permissive, more useful definition
implemented by GCC rather than the one implemented by EDG.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150875 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.prim/expr.prim.lambda/blocks.cpp
xpr.prim/expr.prim.lambda/p16.cpp
xpr.prim/expr.prim.lambda/p18.cpp
68932845a432d2a1dbbc57a84fd85bbb37c90487 18-Feb-2012 Douglas Gregor <dgregor@apple.com> Unify our computation of the type of a captured reference to a
variable; it was previously duplicated, and one of the copies failed
to account for outer non-mutable lambda captures.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150872 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.prim/expr.prim.lambda/p16.cpp
xpr.prim/expr.prim.lambda/p18.cpp
bd64520ca4e4d4c531637d311f8ea384c912fce8 17-Feb-2012 Douglas Gregor <dgregor@apple.com> Only add 'const' to the type of variables captured in a lambda when
we're capturing it by value in a non-mutable lambda.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150791 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.prim/expr.prim.lambda/p18.cpp
7bdc15252ca2415f149ad812f0e5184d758e6105 16-Feb-2012 Douglas Gregor <dgregor@apple.com> Lambda closure types are always considered to be like "local" classes,
even if they are not within a function scope. Teach template
instantiation to treat them as such, and make sure that we have a
local instantiation scope when instantiating default arguments and
static data members.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150725 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.prim/expr.prim.lambda/templates.cpp
f6e2e0291b8964ed41b4325e21dd90b86e791f10 16-Feb-2012 Douglas Gregor <dgregor@apple.com> Implicitly define a lambda's conversion functions (to function
pointers and block pointers). We use dummy definitions to keep the
invariant that an implicit, used definition has a body; IR generation
will substitute the actual contents, since they can't be represented
as C++.

For the block pointer case, compute the copy-initialization needed to
capture the lambda object in the block, which IR generation will need
later.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150645 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.prim/expr.prim.lambda/blocks.cpp
c2956e5681113bbcec5ff98833345166942a211b 15-Feb-2012 Douglas Gregor <dgregor@apple.com> Lambda closure types have a conversion function to a block pointer
with the same parameter types and return type as the function call
operator. This is the real answer to

http://stackoverflow.com/questions/4148242/is-it-possible-to-convert-a-c0x-lambda-to-a-clang-block

:)


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150620 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.prim/expr.prim.lambda/blocks.cpp
e4e68d45f89ff4899d30cbd196603d09b7fbc150 15-Feb-2012 Douglas Gregor <dgregor@apple.com> When overload resolution picks an implicitly-deleted special member
function, provide a specialized diagnostic that indicates the kind of
special member function (default constructor, copy assignment
operator, etc.) and that it was implicitly deleted. Add a hook where
we can provide more detailed information later.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150611 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.prim/expr.prim.lambda/p19.cpp
87c5150752baafab380e5f7837a32410fa83c7dc 15-Feb-2012 Douglas Gregor <dgregor@apple.com> A little more lambda capture initialization diagnostics cleanup

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150589 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.prim/expr.prim.lambda/p14.cpp
4773654f2700d6fbb20612fbb6763b35860fa74d 15-Feb-2012 Douglas Gregor <dgregor@apple.com> Introduce a new initialization entity for lambda captures, and
specialize location information and diagnostics for this entity.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150588 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.prim/expr.prim.lambda/p14.cpp
793cd1c4cdfaafc52e2c2ad9dae959befe4bb166 15-Feb-2012 Douglas Gregor <dgregor@apple.com> Specialize noreturn diagnostics for lambda expressions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150586 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.prim/expr.prim.lambda/p5.cpp
xpr.prim/expr.prim.lambda/p7.cpp
xpr.prim/expr.prim.lambda/templates.cpp
4e88df72e690498aeba2dc3d5089388b27be66fa 15-Feb-2012 Douglas Gregor <dgregor@apple.com> Specialize the diagnostic complaining about conflicting types of
return statements within a lambda; this diagnostic previously referred
to blocks.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150584 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.prim/expr.prim.lambda/p4.cpp
83587db1bda97f45d2b5a4189e584e2a18be511a 15-Feb-2012 Richard Smith <richard-llvm@metafoo.co.uk> Implement DR1454. This allows all intermediate results in constant expressions
to be core constant expressions (including pointers and references to
temporaries), and makes constexpr calculations Turing-complete. A Turing machine
simulator is included as a testcase.

This opens up the possibilty of removing CCValue entirely, and removing some
copies from the constant evaluator in the process, but that cleanup is not part
of this change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150557 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.const/p2-0x.cpp
c6889e7ed16604c51994e1f11becf213fdc64eb3 14-Feb-2012 Douglas Gregor <dgregor@apple.com> Implement C++ core issue 974, which permits default arguments for
lambda expressions. Because these issue was pulled back from Ready
status at the Kona meeting, we still emit an ExtWarn when using
default arguments for lambda expressions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150519 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.prim/expr.prim.lambda/default-arguments.cpp
xpr.prim/expr.prim.lambda/p5.cpp
53393f23d8b767f976427a6d45b310bf37dd91c4 14-Feb-2012 Douglas Gregor <dgregor@apple.com> Check the return type of lambda expressions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150503 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.prim/expr.prim.lambda/p4.cpp
xpr.prim/expr.prim.lambda/p4.mm
a73652465bcc4c0f6cb7d933ad84e002b527a643 14-Feb-2012 Douglas Gregor <dgregor@apple.com> Implement support for lambda capture pack expansions, e.g.,

[&values...] { print(values...); }




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150497 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.prim/expr.prim.lambda/p23.cpp
d764437c9ce6feae11a9fca35bbc4ebc004f69e0 14-Feb-2012 Douglas Gregor <dgregor@apple.com> Simple test ensuring that we perform direct initialization when copy-capturing in lambdas

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150442 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.prim/expr.prim.lambda/p21.cpp
d5387e86ce3dfe1ae09e050ee11d86ca0d066d04 14-Feb-2012 Douglas Gregor <dgregor@apple.com> Link together the call operator produced from transforming a lambda
expression with the original call operator, so that we don't try to
separately instantiate the call operator. Test and tweak a few more
bits for template instantiation of lambda expressions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150440 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.prim/expr.prim.lambda/templates.cpp
dfca6f53ab97d28d43e3fa2564209df08f3d282c 13-Feb-2012 Douglas Gregor <dgregor@apple.com> Introduce support for template instantiation of lambda
expressions. This is mostly a simple refact, splitting the main "start
a lambda expression" function into smaller chunks that are driven
either from the parser (Sema::ActOnLambdaExpr) or during AST
transformation (TreeTransform::TransformLambdaExpr). A few minor
interesting points:

- Added new entry points for TreeTransform, so that we can
explicitly establish the link between the lambda closure type in the
template and the lambda closure type in the instantiation.
- Added a bit into LambdaExpr specifying whether it had an explicit
result type or not. We should have had this anyway.

This code is 'lightly' tested.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150417 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.prim/expr.prim.lambda/templates.cpp
86c3ae46250cdcc57778c27826060779a92f3815 13-Feb-2012 Richard Smith <richard-llvm@metafoo.co.uk> Update constexpr implementation to match CWG's chosen approach for core issues
1358, 1360, 1452 and 1453.
- Instantiations of constexpr functions are always constexpr. This removes the
need for separate declaration/definition checking, which is now gone.
- This makes it possible for a constexpr function to be virtual, if they are
only dependently virtual. Virtual calls to such functions are not constant
expressions.
- Likewise, it's now possible for a literal type to have virtual base classes.
A constexpr constructor for such a type cannot actually produce a constant
expression, though, so add a special-case diagnostic for a constructor call
to such a type rather than trying to evaluate it.
- Classes with trivial default constructors (for which value initialization can
produce a fully-initialized value) are considered literal types.
- Classes with volatile members are not literal types.
- constexpr constructors can be members of non-literal types. We do not yet use
static initialization for global objects constructed in this way.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150359 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.const/p2-0x.cpp
f8af98286022f72157d84951b48fde5fb369ab29 12-Feb-2012 Douglas Gregor <dgregor@apple.com> Within the body of a lambda expression, decltype((x)) for an
id-expression 'x' will compute the type based on the assumption that
'x' will be captured, even if it isn't captured, per C++11
[expr.prim.lambda]p18. There are two related refactors that go into
implementing this:

1) Split out the check that determines whether we should capture a
particular variable reference, along with the computation of the
type of the field, from the actual act of capturing the
variable.
2) Always compute the result of decltype() within Sema, rather than
AST, because the decltype() computation is now context-sensitive.




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150347 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.prim/expr.prim.lambda/p12.cpp
xpr.prim/expr.prim.lambda/p18.cpp
215e4e17d00e12c38687a95502506d8f2ca3e646 12-Feb-2012 Douglas Gregor <dgregor@apple.com> Lambdas have a deleted default constructor and a deleted copy
assignment operator, per C++ [expr.prim.lambda]p19. Make it so.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150345 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.prim/expr.prim.lambda/p19.cpp
xpr.prim/expr.prim.lambda/p20.cpp
xpr.prim/expr.prim.lambda/p5.cpp
xpr.prim/expr.prim.lambda/p7.cpp
668165ab1e604b063c0aa0df8ff91c80879670bf 11-Feb-2012 Eli Friedman <eli.friedman@gmail.com> Make sure Sema creates a field for 'this' captures. (Doug, please double-check that this is correct.)



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150292 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.prim/expr.prim.lambda/p14.cpp
8e9314fd846936ce04b92b2b72c6aba2cffab916 11-Feb-2012 Douglas Gregor <dgregor@apple.com> Add simple semantic test for C++11 [expr.prim.lambda]p16, which covers recursive capture. This is far more interesting for IRgen.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150283 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.prim/expr.prim.lambda/p16.cpp
f0459f87aaf05e76ce0d8c8c1e4c68e3c22195b7 11-Feb-2012 Douglas Gregor <dgregor@apple.com> Implement C++11 [expr.lambda.prim]p13, which prohibits lambdas in
default arguments if in fact those lambdas capture any entity.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150282 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.prim/expr.prim.lambda/p13.cpp
3ac109cd17151bb8ad3a40b0cbb0e1923cd6c4a0 10-Feb-2012 Douglas Gregor <dgregor@apple.com> Allow implicit capture of 'this' in a lambda even when the capture
default is '=', and reword the warning about explicitly capturing
'this' in such lambdas to indicate that only explicit capture is
banned.

Introduce Fix-Its for this and other "save the programmer from
themself" rules regarding what can be explicitly captured and what
must be implicitly captured.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150256 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.prim/expr.prim.lambda/p8.cpp
67b2c554dc12f589471713b7b01e9c94257ae593 10-Feb-2012 Douglas Gregor <dgregor@apple.com> Add test from [expr.prim.lambda]p12, which deals with odr-use and
nested captures. We currently don't get odr-use correct in array
bounds, so that bit is commented out while we sort out what we need to
do.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150255 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.prim/expr.prim.lambda/p12.cpp
b555971345750350c21d541afe135054c7402933 10-Feb-2012 Douglas Gregor <dgregor@apple.com> Don't introduce a lambda's operator() into the class until after we
have finished parsing the body, so that name lookup will never find
anything within the closure type. Then, add this operator() and the
conversion function (if available) before completing the class.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150252 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.prim/expr.prim.lambda/p7.cpp
93e2fa488740a68604a4069ac61eba398de7275d 10-Feb-2012 Douglas Gregor <dgregor@apple.com> Add a lambda example from the working draft.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150239 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.prim/expr.prim.lambda/p8.cpp
73d90928c0462daf0665fd7f8e44ca00d896540d 10-Feb-2012 Douglas Gregor <dgregor@apple.com> Add various tests for captures and the reaching scope of the lambda
expression. Implement C++11 [expr.prim.lambda]p12's requirement that
capturing a variable will odr-use it.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150237 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.prim/expr.prim.lambda/p10.cpp
xpr.prim/expr.prim.lambda/p11.cpp
xpr.prim/expr.prim.lambda/p12.cpp
ef7d78bd5be466c369b04af742ed8268244d4fe7 10-Feb-2012 Douglas Gregor <dgregor@apple.com> Implement the conversion to a function pointer for lambda expressions,
per C++ [expr.prim.lambda]p6.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150236 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.prim/expr.prim.lambda/p5.cpp
xpr.prim/expr.prim.lambda/p6.cpp
864b1cf13b288c5099911e1265431ffdcac060a4 10-Feb-2012 Richard Smith <richard-llvm@metafoo.co.uk> Update to new resolution for DR1458. When taking the address of an object of
incomplete class type which has an overloaded operator&, it's now just
unspecified whether the overloaded operator or the builtin is used.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150234 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.const/p2-0x.cpp
a0c2b21e0d84ad289781e08e14148da6b8b8b76d 09-Feb-2012 Douglas Gregor <dgregor@apple.com> Don't allow deduction of a lambda result type from an initializer
list; it is not an expression.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150194 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.prim/expr.prim.lambda/p4.cpp
8d9bd653fc99e91ac79dbeb7cfa2abf18eda4d04 09-Feb-2012 Douglas Gregor <dgregor@apple.com> Tests for C++ [expr.prim.lambda]p5. We already implement all of these
semantics.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150190 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.prim/expr.prim.lambda/p5.cpp
54042f1bd78f1f1ea86be7d4af541462e127d2ed 09-Feb-2012 Douglas Gregor <dgregor@apple.com> Implement return type deduction for lambdas per C++11
[expr.prim.lambda]p4, including the current suggested resolution of
core isue 975, which allows multiple return statements so long as the
types match. ExtWarn when user code is actually making use of this
extension.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150168 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.prim/expr.prim.lambda/p4.cpp
b326ca8ffbea96f9cc8a457b0f57be880304a6f5 09-Feb-2012 Douglas Gregor <dgregor@apple.com> Remove the "unsupported" error for lambda expressions. It's annoying,
and rapidly becoming untrue.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150165 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.prim/expr.prim.lambda/blocks.cpp
xpr.prim/expr.prim.lambda/p10.cpp
xpr.prim/expr.prim.lambda/p14.cpp
xpr.prim/expr.prim.lambda/p15.cpp
xpr.prim/expr.prim.lambda/p2.cpp
xpr.prim/expr.prim.lambda/p3.cpp
xpr.prim/expr.prim.lambda/p5.cpp
xpr.prim/expr.prim.lambda/p7.cpp
xpr.prim/expr.prim.lambda/p8.cpp
7e545d95bc92157f9f124d95aa2ed66d691d2028 09-Feb-2012 Douglas Gregor <dgregor@apple.com> Add a test for the non-aggregaticity of lambda types per C++11
[expr.prim.lambda].


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150164 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.prim/expr.prim.lambda/p3.cpp
e2c5913c48f66bfec9e58a8ad1d90e5eeffad586 09-Feb-2012 Douglas Gregor <dgregor@apple.com> Implement C++ [expr.prim.lambda]p2, which bans lambda expressions in
unevaluated operands. Be certain that we're marking everything
referenced within a capture initializer as odr-used.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150163 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.prim/expr.prim.lambda/p2.cpp
18fe084d72392a5ceaa1fab7d3f3f0d0f2538069 09-Feb-2012 Douglas Gregor <dgregor@apple.com> Implement capture-by-copy for arrays in lambdas.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150138 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.prim/expr.prim.lambda/p14.cpp
xpr.prim/expr.prim.lambda/p15.cpp
20f87a4cd91b8d76571dc96aece916ac0bdf8b9f 09-Feb-2012 Douglas Gregor <dgregor@apple.com> When we create a non-static data member in the closure object for a
capture, make sure we actually add the field.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150135 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.prim/expr.prim.lambda/p14.cpp
503384f731b5abcbf870b0a5224eb920e631db0a 09-Feb-2012 Douglas Gregor <dgregor@apple.com> Various interrelated cleanups for lambdas:
- Complete the lambda class when we finish the lambda expression
(previously, it was left in the "being completed" state)
- Actually return the LambdaExpr object and bind to the resulting
temporary when needed.
- Detect when cleanups are needed while capturing a variable into a
lambda (e.g., due to default arguments in the copy constructor), and
make sure those cleanups apply for the whole of the lambda
expression.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150123 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.prim/expr.prim.lambda/p10.cpp
xpr.prim/expr.prim.lambda/p14.cpp
xpr.prim/expr.prim.lambda/p15.cpp
xpr.prim/expr.prim.lambda/p5.cpp
xpr.prim/expr.prim.lambda/p7.cpp
xpr.prim/expr.prim.lambda/p8.cpp
6d2f0f589a8c38f64147e90ccdd813dde74ecdb6 08-Feb-2012 Douglas Gregor <dgregor@apple.com> Minor comment fix

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150090 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.prim/expr.prim.lambda/p7.cpp
1e3767ac5449db6a1ede192d5e4217e34fa61f26 08-Feb-2012 Douglas Gregor <dgregor@apple.com> When computing the type of a local variable reference within a lambda,
only add 'const' for variables captured by copy in potentially
evaluated expressions of non-mutable lambdas. (The "by copy" part was
missing).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150088 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.prim/expr.prim.lambda/p7.cpp
76e3da57b0e8cf72d221f44d54566ef206341668 08-Feb-2012 Douglas Gregor <dgregor@apple.com> When completing a lambda expression, make sure to check and attach the
body of the lambda to the function call operator.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150087 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.prim/expr.prim.lambda/p15.cpp
xpr.prim/expr.prim.lambda/p7.cpp
2fd5983e0da447291a651a347c206aee37a1de5f 08-Feb-2012 Richard Smith <richard-llvm@metafoo.co.uk> Implement DR1458: Taking the address of an object of incomplete class type is
not a constant expression, because we can't tell whether the complete class type
will have an overloaded operator&.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150066 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.const/p2-0x.cpp
3f83d0de1d14f73c4c9acad76990385905e4b660 08-Feb-2012 Richard Smith <richard-llvm@metafoo.co.uk> Add more testing for r149776.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150061 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.const/p5-0x.cpp
925d8e7c0f18e03dc4bc634b3c6c1ec09373d993 08-Feb-2012 Richard Smith <richard-llvm@metafoo.co.uk> Implement the agreed resolution to DR1457: a signed left shift of a 1 bit into
the sign bit doesn't have undefined behavior, but a signed left shift of a 1 bit
out of the sign bit still does. As promised to Howard :)

The suppression of the potential constant expression checking in system headers
is also removed, since the problem it was working around is gone.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150059 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.const/p2-0x.cpp
01d08018b7cf5ce1601707cfd7a84d22015fc04e 07-Feb-2012 Douglas Gregor <dgregor@apple.com> Introduce basic ASTs for lambda expressions. This covers:
- Capturing variables by-reference and by-copy within a lambda
- The representation of lambda captures
- The creation of the non-static data members in the lambda class
that store the captured variables
- The initialization of the non-static data members from the
captured variables
- Pretty-printing lambda expressions

There are a number of FIXMEs, both explicit and implied, including:
- Creating a field for a capture of 'this'
- Improved diagnostics for initialization failures when capturing
variables by copy
- Dealing with temporaries created during said initialization
- Template instantiation
- AST (de-)serialization
- Binding and returning the lambda expression; turning it into a
proper temporary
- Lots and lots of semantic constraints
- Parameter pack captures


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149977 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.prim/expr.prim.lambda/p14.cpp
xpr.prim/expr.prim.lambda/p15.cpp
9ec7197796a2730d54ae7f632553b5311b2ba3b5 05-Feb-2012 Richard Smith <richard-llvm@metafoo.co.uk> constexpr: Fix implementation of DR1311: check for volatile qualifiers in
lvalue-to-rvalue conversions on the source type of the conversion, not the
target type (which has them removed for non-class types).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149796 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.const/p2-0x.cpp
282e7e66748cc6dd14d6f7f2cb52e5373c531e61 04-Feb-2012 Richard Smith <richard-llvm@metafoo.co.uk> In C++11 mode, when an integral constant expression is desired and we have a
value of class type, look for a unique conversion operator converting to
integral or unscoped enumeration type and use that. Implements [expr.const]p5.

Sema::VerifyIntegerConstantExpression now performs the conversion and returns
the converted result. Some important callers of Expr::isIntegralConstantExpr
have been switched over to using it (including all of those required for C++11
conformance); this switch brings a side-benefit of improved diagnostics and, in
several cases, simpler code. However, some language extensions and attributes
have not been moved across and will not perform implicit conversions on
constant expressions of literal class type where an ICE is required.

In passing, fix static_assert to perform a contextual conversion to bool on its
argument.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149776 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.const/p2-0x.cpp
b942cb24a060435b18fef5b43eb33d77afc0d03a 03-Feb-2012 Eli Friedman <eli.friedman@gmail.com> Implement implicit capture for lambda expressions.

Still left: explicit captures in lambdas need to cause implicit capture, and I need to take a look at the diagnostics for some cases.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149718 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.prim/expr.prim.lambda/blocks.cpp
f15fda02e9c8c82b4a716618f4010b9af8bff796 02-Feb-2012 Richard Smith <richard-llvm@metafoo.co.uk> constexpr:
* support the gcc __builtin_constant_p() ? ... : ... folding hack in C++11
* check for unspecified values in pointer comparisons and pointer subtractions


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149578 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.const/p2-0x.cpp
b710dfe5231b0cd44dd987b9bd33c7f6ac165807 01-Feb-2012 Douglas Gregor <dgregor@apple.com> Diagnose the restriction on default arguments in C++11 [expr.prim.lambda]p5.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149517 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.prim/expr.prim.lambda/p5.cpp
15efc4d597a47e6ba5794d4fd8d561bf6947233c 01-Feb-2012 Richard Smith <richard-llvm@metafoo.co.uk> constexpr: check for overflow in pointer subtraction.

This is a mess. According to the C++11 standard, pointer subtraction only has
undefined behavior if the difference of the array indices does not fit into a
ptrdiff_t.

However, common implementations effectively perform a char* subtraction first,
and then divide the result by the element size, which can cause overflows in
some cases. Those cases are not considered to be undefined behavior by this
change; perhaps they should be.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149490 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.const/p2-0x.cpp
7b48a2986345480241f3b8209f71bb21b0530b4f 01-Feb-2012 Richard Smith <richard-llvm@metafoo.co.uk> constexpr: overflow checking for integral and floating-point arithmetic.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149473 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.const/p2-0x.cpp
b04035a7b1a3c9b93cea72ae56dd2ea6e787bae9 01-Feb-2012 Richard Smith <richard-llvm@metafoo.co.uk> constexpr: require 'this' to point to an object in a constexpr method call.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149467 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.const/p2-0x.cpp
93962e5360a43200faa70939571afc4fb9326cf7 01-Feb-2012 Douglas Gregor <dgregor@apple.com> Improve checking of explicit captures in a C++11 lambda expression:
- Actually building the var -> capture mapping properly (there was an off-by-one error)
- Keeping track of the source location of each capture
- Minor QoI improvements, e.g, highlighing the prior capture if
there are multiple captures, pointing at the variable declaration we
found if we reject it.

As part of this, add standard citations for the various semantic
checks we perform, and note where we're not performing those checks as
we should.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149462 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.prim/expr.prim.lambda/p10.cpp
xpr.prim/expr.prim.lambda/p8.cpp
fe9b559f81535ade84d24c42569378f80df47847 01-Feb-2012 Douglas Gregor <dgregor@apple.com> Diagnose attempts to explicitly capture a __block variable in a lambda.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149458 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.prim/expr.prim.lambda/blocks.cpp
3df61308ddfbdba0897b762a129b5a38750c87d0 01-Feb-2012 Richard Smith <richard-llvm@metafoo.co.uk> constexpr: Treat INT_MIN % -1 as undefined behavior in C++11. Technically, it
isn't, but this is just a (reported) defect in the wording.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149448 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.const/p2-0x.cpp
82f28583b8e81ae9b61635a0652f6a45623df16d 31-Jan-2012 Richard Smith <richard-llvm@metafoo.co.uk> constexpr: the result of a relational operator between pointers to void is
unspecified unless the pointers are equal; therefore, such a comparison is not
a constant expression unless the pointers are equal.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149366 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.const/p2-0x.cpp
789f9b6be5df6e5151ac35e68416cdf550db1196 31-Jan-2012 Richard Smith <richard-llvm@metafoo.co.uk> constexpr: catch a collection of integral undefined behaviors:
-INT_MIN and INT_MIN / -1
Shift by a negative or too large quantity
Left shift of negative value
Overflow in left shift



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149344 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.const/p2-0x.cpp
395f1c08ff720be7df6535a86df14b6d36a2d57a 31-Jan-2012 Richard Smith <richard-llvm@metafoo.co.uk> constexpr: remove integral conversion overflow checking introduced in r149286.
As Eli points out, this is implementation-defined, and the way we define it
makes this fine.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149327 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.const/p2-0x.cpp
f72fccf533bca206af8e75d041c29db99e6a7f2c 30-Jan-2012 Richard Smith <richard-llvm@metafoo.co.uk> constexpr: disallow signed integer overflow in integral conversions in constant
expressions in C++11.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149286 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.const/p2-0x.cpp
5e089fe1affb63d670ea02010b104bd9fa3477a1 24-Jan-2012 David Blaikie <dblaikie@gmail.com> Support decltype as a simple-type-specifier.

This makes all sorts of fun examples work with decltype.
Reviewed by Richard Smith.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148787 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.post/expr.type.conv/p1-0x.cpp
ef331b783bb96a0f0e34afdb7ef46677dc4764cb 20-Jan-2012 Eli Friedman <eli.friedman@gmail.com> Remove PotentiallyPotentiallyEvaluated, and replace it with a much simpler and less error-prone way of handling the relevant cases. Towards marking of whether a declaration is used more accurately.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148522 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.prim/expr.prim.general/p12-0x.cpp
8ef7b203332b0c8d65876a1f5e6d1db4e6f40e4b 19-Jan-2012 Richard Smith <richard-llvm@metafoo.co.uk> constexpr: converted constant expression handling for enumerator values, case
values and non-type template arguments of integral and enumeration types.

This change causes some legal C++98 code to no longer compile in C++11 mode, by
enforcing the C++11 rule that narrowing integral conversions are not permitted
in the final implicit conversion sequence for the above cases.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148439 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.const/p2-0x.cpp
xpr.const/p3-0x.cpp
9bc291d5c00f47383ce7358e6309abf45324b028 18-Jan-2012 Eli Friedman <eli.friedman@gmail.com> Make PotentiallyPotentiallyEvaluated contexts work correctly when referencing a class field from outside an instance method.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148376 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.prim/expr.prim.general/p12-0x.cpp
244ee7b89a483fd3764637abdf95de2893b437d0 15-Jan-2012 Richard Smith <richard-llvm@metafoo.co.uk> Pedantic diagnostic correction: in C++, we have integral constant expressions,
not integer constant expressions. In passing, fix the 'folding is an extension'
diagnostic to not claim we're accepting the code, since that's not true in
-pedantic-errors mode, and add this diagnostic to -Wgnu.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148209 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.const/p2-0x.cpp
61e616206413d1779c7545c7a8ad1ce1129ad9c1 12-Jan-2012 Richard Smith <richard-llvm@metafoo.co.uk> Allow constant-folding of references which were formed in a manner not permitted
in a constant expression, for compatibility with g++.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148020 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.const/p2-0x.cpp
b4e85ed51905fc94378d7b4ff62b06e0d08042b7 06-Jan-2012 Richard Smith <richard-llvm@metafoo.co.uk> C++11 generalized constant expressions: implement checking and diagnostics for
pointer-arithmetic-related undefined behavior and unspecified results. We
continue to fold such values, but now notice they aren't constant expressions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147659 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.const/p2-0x.cpp
51201882382fb40c9456a06c7f93d6ddd4a57712 30-Dec-2011 Richard Smith <richard-llvm@metafoo.co.uk> Unrevert r147271, reverted in r147361.

Also temporarily remove the assumption from IR gen that we can emit IR for every
constant we can fold, since it isn't currently true in C++11, to fix PR11676.

Original comment from r147271:

constexpr: perform zero-initialization prior to / instead of performing a
constructor call when appropriate. Thanks to Eli for spotting this.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147384 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.const/p2-0x.cpp
f8c2a33b6e47c494b83e68f02f4ee67ca8fd8e3b 30-Dec-2011 Rafael Espindola <rafael.espindola@gmail.com> Revert r147271. This fixes PR11676.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147362 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.const/p2-0x.cpp
47d2145675099893d702be4bc06bd9f26d8ddd13 27-Dec-2011 Richard Smith <richard-llvm@metafoo.co.uk> constexpr: support for evaluation and codegen of typeid constants.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147290 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.const/p2-0x.cpp
eba05b2e396e1474f7bd6e8e8e1bd7752effef4d 25-Dec-2011 Richard Smith <richard-llvm@metafoo.co.uk> constexpr: perform zero-initialization prior to / instead of performing a
constructor call when appropriate. Thanks to Eli for spotting this.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147271 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.const/p2-0x.cpp
7098cbd601ad915aed22d4b5850da99359f25bf3 21-Dec-2011 Richard Smith <richard-llvm@metafoo.co.uk> constexpr: diagnostic improvements for invalid lvalue-to-rvalue conversions in
constant expressions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147035 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.const/p2-0x.cpp
f6702a3927147655206ae729a84339c4fda4c651 20-Dec-2011 Richard Smith <richard-llvm@metafoo.co.uk> Unlike in C++03, a constant-expression is not an unevaluated operand in C++11.
Split out a new ExpressionEvaluationContext flag for this case, and don't treat
it as unevaluated in C++11. This fixes some crash-on-invalids where we would
allow references to class members in potentially-evaluated constant expressions
in static member functions, and also fixes half of PR10177.

The fix to PR10177 exposed a case where template instantiation failed to provide
a source location for a diagnostic, so TreeTransform has been tweaked to supply
source locations when transforming a type. The source location is still not very
good, but MarkDeclarationsReferencedInType would need to operate on a TypeLoc to
improve it further.

Also fix MarkDeclarationReferenced in C++98 mode to trigger instantiation for
static data members of class templates which are used in constant expressions.
This fixes a link-time problem, but we still incorrectly treat the member as
non-constant. The rest of the fix for that issue is blocked on PCH support for
early-instantiated static data members, which will be added in a subsequent
patch.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146955 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.prim/expr.prim.general/p12-0x.cpp
099e7f647ccda915513f2b2ec53352dc756082d3 19-Dec-2011 Richard Smith <richard-llvm@metafoo.co.uk> constexpr handling improvements. Produce detailed diagnostics when a 'constexpr'
variable is initialized by a non-constant expression, and pass in the variable
being declared so that earlier-initialized fields' values can be used.

Rearrange VarDecl init evaluation to make this possible, and in so doing fix a
long-standing issue in our C++ constant expression handling, where we would
mishandle cases like:

extern const int a;
const int n = a;
const int a = 5;
int arr[n];

Here, n is not initialized by a constant expression, so can't be used in an ICE,
even though the initialization expression would be an ICE if it appeared later
in the TU. This requires computing whether the initializer is an ICE eagerly,
and saving that information in PCH files.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146856 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.const/p2-0x.cpp
1e7fc3d31e17fbe314f86de96aac6e9a2f297167 16-Dec-2011 Richard Smith <richard-llvm@metafoo.co.uk> Reduce recursion limit on this test further to try to make the msys bot green.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146759 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.const/p2-0x.cpp
08d6e032a2a0a8656d12b3b7b93942987bb12eb7 16-Dec-2011 Richard Smith <richard-llvm@metafoo.co.uk> C++11 constexpr: Add note stacks containing backtraces if constant evaluation
fails within a call to a constexpr function. Add -fconstexpr-backtrace-limit
argument to driver and frontend, to control the maximum number of notes so
produced (default 10). Fix APValue printing to be able to pretty-print all
APValue types, and move the testing for this functionality from a unittest to
a -verify test now that it's visible in clang's output.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146749 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.const/p2-0x.cpp
0a36512b175103d60020aaa857363dca33f36558 14-Dec-2011 Richard Smith <richard-llvm@metafoo.co.uk> Halve the constexpr recursion depth in this test in an attempt to make the
freebsd bots happy. In the longer term, we should have a mechanism for moving
constexpr recursion off the call stack, to support the default limit of 512
suggested by the standard.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146596 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.const/p2-0x.cpp
d3d08533116b4ad5ff5d29c88a0e136687297058 14-Dec-2011 Douglas Gregor <dgregor@apple.com> Don't consider an overloaded operator& when the expression is actually
going to be a pointer-to-member constant. Fixes <rdar://problem/10544564>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146587 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.unary/expr.unary.op/p3.cpp
df512bfbc4b8c00202ea7a8c900c59ec55890676 13-Dec-2011 David Blaikie <dblaikie@gmail.com> Disallow decltype in qualified declarator-ids.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146480 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.prim/expr.prim.general/p8-0x.cpp
c1c5f27c64dfc3332d53ad30e44d626e4f9afac3 13-Dec-2011 Richard Smith <richard-llvm@metafoo.co.uk> Add checks and diagnostics for many of the cases which C++11 considers to not
be constant expressions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146479 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.const/p2-0x.cpp
42d6d0c91ab089cb252ab2f91c16d4557f458a2c 04-Dec-2011 David Blaikie <dblaikie@gmail.com> Support decltype in nested-name-specifiers.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145785 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.prim/expr.prim.general/p4-0x.cpp
xpr.prim/expr.prim.general/p8-0x.cpp
921da24fff5e23d629740e0bc88c4ff02e955ca2 07-Nov-2011 David Blaikie <dblaikie@gmail.com> Move tests to the appropriate directory to match the spec hierarchy.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143906 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.prim/expr.prim.general/p12-0x.cpp
xpr.prim/expr.prim.general/p4-0x.cpp
xpr.prim/p12-0x.cpp
xpr.prim/p4-0x.cpp
b8e778da8545624826440366a709d555332ffc73 14-Oct-2011 Douglas Gregor <dgregor@apple.com> Don't try to diagnose anything when we're passing incomplete types
through varargs. This only happens when we're in an unevaluated
context, where we don't want to trigger an error anyway. Fixes PR11131
/ <rdar://problem/10288375>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141986 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.post/expr.call/p7-0x.cpp
762bb9d0ad20320b9f97a841dce57ba5e8e48b07 14-Oct-2011 Richard Smith <richard-llvm@metafoo.co.uk> Update all tests other than Driver/std.cpp to use -std=c++11 rather than
-std=c++0x. Patch by Ahmed Charles!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141900 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.cast/p4-0x.cpp
xpr.const/p2-0x.cpp
xpr.mptr.oper/p6-0x.cpp
xpr.post/expr.call/p7-0x.cpp
xpr.post/expr.const.cast/p1-0x.cpp
xpr.post/expr.dynamic.cast/p3-0x.cpp
xpr.post/expr.reinterpret.cast/p1-0x.cpp
xpr.post/expr.static.cast/p3-0x.cpp
xpr.post/expr.static.cast/p9-0x.cpp
xpr.prim/p12-0x.cpp
xpr.prim/p4-0x.cpp
xpr.unary/expr.new/p2-cxx0x.cpp
xpr.unary/expr.new/p20-0x.cpp
xpr.unary/expr.sizeof/p5-0x.cpp
xpr.unary/expr.unary.noexcept/cg.cpp
xpr.unary/expr.unary.noexcept/sema.cpp
ee697e69a2063b65bfd0534248e4848461aca3f4 13-Oct-2011 Douglas Gregor <dgregor@apple.com> Allow calling an overloaded function set by taking the address of the
functions, e.g., (&f)(0). Fixes <rdar://problem/9803316>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141877 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.unary/expr.unary.op/p6.cpp
6dbba4fc128e2e2f5b26be996392bd32c0707f13 12-Oct-2011 John McCall <rjmccall@apple.com> Catch placeholder types in DefaultLvalueConversion
and DefaultFunctionArrayLvalueConversion. To prevent
significant regression for should-this-be-a-call fixits,
and to repair some such regression from the introduction of
bound member placeholders, make those placeholder checks
try to build calls appropriately. Harden the build-a-call
logic while we're at it.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141738 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.unary/expr.unary.op/p6.cpp
7a614d8380297fcd2bc23986241905d97222948c 11-Jun-2011 Richard Smith <richard-llvm@metafoo.co.uk> Implement support for C++11 in-class initialization of non-static data members.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132878 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.prim/p12-0x.cpp
xpr.prim/p4-0x.cpp
63fe6814f339df30b8463b39995947cbdf920e48 24-May-2011 Douglas Gregor <dgregor@apple.com> Implement the initial part of C++0x [expr.const]p2, which specifies
that the unevaluated subexpressions of &&, ||, and ? : are not
considered when determining whether the expression is a constant
expression. Also, turn the "used in its own initializer" warning into
a runtime-behavior warning, so that it doesn't fire when a variable is
used as part of an unevaluated subexpression of its own initializer.

Fixes PR9999.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131968 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.const/p2-0x.cpp
0fd228d48bbf05d08d9b408023d7c8ddb681bc91 21-May-2011 Douglas Gregor <dgregor@apple.com> Implement C++0x semantics for passing non-POD classes through varargs.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131792 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.post/expr.call/p7-0x.cpp
ebc93e176dad36fa8a28dd3a36c5b3dc7630d87d 12-May-2011 Eli Friedman <eli.friedman@gmail.com> PR9899: handle pseudo-destructors correctly in noexcept() expressions.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131220 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.unary/expr.unary.noexcept/sema.cpp
be57cf41fb55b48e3f889787960b3ac2eb5e4dbd 11-May-2011 Eli Friedman <eli.friedman@gmail.com> PR9882: Fix noexcept to deal with dependent new, delete, calls, and
dynamic_cast correctly.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131177 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.unary/expr.unary.noexcept/sema.cpp
db2eae639d3b7ed61ceb56890b73168517ef57f1 16-Mar-2011 Douglas Gregor <dgregor@apple.com> Clean up our handling of template-ids that resolve down to a single
overload, so that we actually do the resolution for full expressions
and emit more consistent, useful diagnostics. Also fixes an IRGen
crasher, where Sema wouldn't diagnose a resolvable bound member
function template-id used in a full-expression (<rdar://problem/9108698>).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127747 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.unary/expr.unary.op/p6.cpp
0eab51c38db24f445ee6d84486169e3e02888489 15-Mar-2011 Sebastian Redl <sebastian.redl@getdesigned.at> Extend the noexcept expression test to test noexcept specification functions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127693 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.unary/expr.unary.noexcept/sema.cpp
abea951c34876a5374d0e3678c7989b225c5c895 28-Feb-2011 Anders Carlsson <andersca@mac.com> Add -fcxx-exceptions to all tests that use C++ exceptions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126599 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.unary/expr.unary.noexcept/cg.cpp
xpr.unary/expr.unary.noexcept/sema.cpp
34b41d939a1328f484511c6002ba2456db879a29 20-Feb-2011 Richard Smith <richard-llvm@metafoo.co.uk> Implement the C++0x deduced 'auto' feature.

This fixes PR 8738, 9060 and 9132.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126069 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.unary/expr.new/p2-cxx0x.cpp
e41721e7dfabcc15cb50be9075a4153f1ad648ea 19-Feb-2011 Anders Carlsson <andersca@mac.com> Pass -fexceptions to all tests that use try/catch/throw.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126037 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.unary/expr.unary.noexcept/cg.cpp
xpr.unary/expr.unary.noexcept/sema.cpp
1e856d99c52d9e93eab48084c3aca4a59204b94b 18-Feb-2011 Douglas Gregor <dgregor@apple.com> Implement C++0x [expr.static.cast]p9, which permits explicitly casting
a scoped enumeration type to an integral or floating type,
properly. There was an over-eager assertion, and it was missing the
floating-point case.

Fixes PR9107/<rdar://problem/8937402>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125825 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.post/expr.static.cast/p9-0x.cpp
6b5a61b6dc400027fd793dcadceeb9da944a37ea 07-Feb-2011 John McCall <rjmccall@apple.com> A few more tweaks to the blocks AST representation:
- BlockDeclRefExprs always store VarDecls
- BDREs no longer store copy expressions
- BlockDecls now store a list of captured variables, information about
how they're captured, and a copy expression if necessary

With that in hand, change IR generation to use the captures data in
blocks instead of walking the block independently.

Additionally, optimize block layout by emitting fields in descending
alignment order, with a heuristic for filling in words when alignment
of the end of the block header is insufficient for the most aligned
field.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125005 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.cast/p4.cpp
fdc13a00a0077383eabf6d994de10203568415bb 04-Feb-2011 Douglas Gregor <dgregor@apple.com> When calling a bound pointer to member function, check the
cv-qualifiers on the object against the cv-qualifiers on the member
function. Fixes PR8315.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124865 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.mptr.oper/p5.cpp
d880f52be3e4a8ccad92ac31932eeae5e0870a93 01-Feb-2011 Douglas Gregor <dgregor@apple.com> Implement access checking for the "delete" operator. Fixes PR9050,
from Alex Miller!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124663 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.unary/expr.delete/p5.cpp
14d0aee957f11b9613fa4312919bec3cc5456a1c 27-Jan-2011 Douglas Gregor <dgregor@apple.com> Fix a horrible bug in our handling of C-style casting, where a C-style
derived-to-base cast that also casts away constness (one of the cases
for static_cast followed by const_cast) would be treated as a bit-cast
rather than a derived-to-base class, causing miscompiles and
heartburn.

Fixes <rdar://problem/8913298>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124340 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.cast/p4.cpp
8ec14e605725a87991f622d63f547f877ba59fef 26-Jan-2011 Douglas Gregor <dgregor@apple.com> Handle C-style casts to rvalue reference types that cast away constness.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124319 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.cast/p4-0x.cpp
6b4df91dc4ed4a3fc78587c49a3ed3df96b65d9c 26-Jan-2011 Douglas Gregor <dgregor@apple.com> Reference qualifiers for *this: implement C++0x [expr.mptr.oper]p6,
the restrictions on .* and ->* for ref-qualified pointer-to-member
functions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124294 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.mptr.oper/p6-0x.cpp
575d2a30f288ddab2f24a77dfcc71f6f7f808394 22-Jan-2011 Douglas Gregor <dgregor@apple.com> Update const_cast semantics for rvalue references. Add tests for
reinterpret_cast and const_cast using rvalue references.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124007 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.post/expr.const.cast/p1-0x.cpp
xpr.post/expr.reinterpret.cast/p1-0x.cpp
dc843f221c95ed404e681b4d782bc81cba14295b 22-Jan-2011 Douglas Gregor <dgregor@apple.com> Teach static_cast and dynamic_cast about rvalue references.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124006 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.post/expr.dynamic.cast/p3-0x.cpp
xpr.post/expr.static.cast/p3-0x.cpp
12c9c00024a01819e3a70ef6d951d32efaeb9312 07-Jan-2011 Douglas Gregor <dgregor@apple.com> Implement substitution of a function parameter pack for its set of
instantiated function parameters, enabling instantiation of arbitrary
pack expansions involving function parameter packs. At this point, we
can now correctly compile a simple, variadic print() example:

#include <iostream>
#include <string>

void print() {}

template<typename Head, typename ...Tail>
void print(const Head &head, const Tail &...tail) {
std::cout << head;
print(tail...);
}

int main() {
std::string hello = "Hello";
print(hello, ", world!", " ", 2011, '\n');
}



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123000 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.unary/expr.sizeof/p5-0x.cpp
ee8aff06f6a96214731de17b2cb6df407c6c1820 04-Jan-2011 Douglas Gregor <dgregor@apple.com> Implement the sizeof...(pack) expression to compute the length of a
parameter pack.

Note that we're missing proper libclang support for the new
SizeOfPackExpr expression node.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122813 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.unary/expr.sizeof/p5-0x.cpp
8e960435696b4ccf6a8ad0ed0530e3280b77af8b 08-Nov-2010 Douglas Gregor <dgregor@apple.com> Properly diagnose invalid casts to function references. Patch by
Faisal Vali, tweaked by me. Fixes PR8230.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118400 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.unary/expr.unary.op/p4.cpp
2cd11fefb62c580651e4269e1488381c2d6d07ad 12-Oct-2010 John McCall <rjmccall@apple.com> Progress.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116287 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.unary/expr.unary.op/p6.cpp
ea844f3aa29c1238683ac98bc1b720e49d97d1f1 20-Sep-2010 Douglas Gregor <dgregor@apple.com> Check that an overloaded function name, when used by the ! operator,
actually resolves to a particular function. Fixes PR8181, from Faisal
Vali!



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114331 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.unary/expr.unary.op/p6.cpp
0b34cf7399e61ef33dc5a3af405351822eeb5f3e 11-Sep-2010 Sebastian Redl <sebastian.redl@getdesigned.at> Test destructors in delete expressions and of temporaries for throwing.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113664 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.unary/expr.unary.noexcept/sema.cpp
5221d8f2da008689f7ff9476e6522bb2b63ec1a3 11-Sep-2010 Sebastian Redl <sebastian.redl@getdesigned.at> Address Doug's comments.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113650 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.unary/expr.unary.noexcept/cg.cpp
xpr.unary/expr.unary.noexcept/sema.cpp
bd7c849de9a1647b235597681c3983ba1e8c6c8b 10-Sep-2010 Sebastian Redl <sebastian.redl@getdesigned.at> Eli helped me understand how evaluation contexts work.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113642 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.unary/expr.unary.noexcept/cg.cpp
ce5eff5c813daead3f51dcfb8261a7b5643ede5c 10-Sep-2010 Sebastian Redl <sebastian.redl@getdesigned.at> Test CXXNoexceptExpr codegen and serialization.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113630 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.unary/expr.unary.noexcept/cg.cpp
xpr.unary/expr.unary.noexcept/ser.h
c574959e7bb9b0fae6fcf07deb6f2ba3f15ec3b1 10-Sep-2010 Sebastian Redl <sebastian.redl@getdesigned.at> Add another small test case.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113628 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.unary/expr.unary.noexcept/sema.cpp
2a822c0c554a7b82ea2cb0f7545e4ed1062f29fc 10-Sep-2010 Sebastian Redl <sebastian.redl@getdesigned.at> Tests for noexcept in templates.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113625 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.unary/expr.unary.noexcept/sema.cpp
295995c9c3196416372c9cd35d9cedb6da37bd3d 10-Sep-2010 Sebastian Redl <sebastian.redl@getdesigned.at> First version of a testcase, plus fixes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113624 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.unary/expr.unary.noexcept/sema.cpp
c988fab9860e83f25ef51101fef162b49380582b 25-Aug-2010 John McCall <rjmccall@apple.com> Catch the case of trying to turn '&(X::a)' into a member pointer as well.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111997 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.unary/expr.unary.op/p4.cpp
565f8d6cc0c5e5a14fa9a8c93970e23378307ff7 07-May-2010 Sebastian Redl <sebastian.redl@getdesigned.at> Test case for my last fix.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103252 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.post/expr.ref/p3.cpp
9c82afc7d1f57b427053e6679d87539b0dc63b1a 20-Apr-2010 John McCall <rjmccall@apple.com> Restore r101841 without modification. Also mark 'operator delete' as used for
actual delete expressions, not just new expressions.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101861 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.unary/expr.new/p19.cpp
xpr.unary/expr.new/p20-0x.cpp
xpr.unary/expr.new/p20.cpp
3609432178ae63977d575065509238ca2fedf455 20-Apr-2010 John McCall <rjmccall@apple.com> Revert r101841 and follow-up.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101859 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.unary/expr.new/p19.cpp
xpr.unary/expr.new/p20-0x.cpp
xpr.unary/expr.new/p20.cpp
af5ece5017d59bd43ccd6dbe172a1f5b57132ff9 20-Apr-2010 John McCall <rjmccall@apple.com> Don't bother looking for (or diagnosing problems with) the 'operator delete'
associated with a new expression if -fno-exceptions is set.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101841 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.unary/expr.new/p19.cpp
xpr.unary/expr.new/p20-0x.cpp
xpr.unary/expr.new/p20.cpp
7002f4c03c2d0544f4e8bea8d3a5636519081e35 09-Apr-2010 John McCall <rjmccall@apple.com> Turn access control on by default in -cc1.
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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100880 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.unary/expr.delete/p5.cpp
6d90870fe821a9b1a7822d3e28032042d03e5680 26-Feb-2010 Douglas Gregor <dgregor@apple.com> Implement semantic analysis for C++ [expr.new]p18-20, which describe
how we find the operator delete that matches withe operator new we
found in a C++ new-expression.

This will also need CodeGen support. On a happy note, we're now a
"nans" away from building tramp3d-v4.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97209 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.unary/expr.new/p19.cpp
xpr.unary/expr.new/p20-0x.cpp
xpr.unary/expr.new/p20.cpp
60c93c9981c467738369702e7aa23fd58c2b6aac 09-Feb-2010 Douglas Gregor <dgregor@apple.com> Migrate the mish-mash of declaration checks in
Sema::ActOnUninitializedDecl over to InitializationSequence (with
default initialization), eliminating redundancy. More importantly, we
now check that a const definition in C++ has an initilizer, which was
an #if 0'd code for many, many months. A few other tweaks were needed
to get everything working again:

- Fix all of the places in the testsuite where we defined const
objects without initializers (now that we diagnose this issue)
- Teach instantiation of static data members to find the previous
declaration, so that we build proper redeclaration
chains. Previously, we had the redeclaration chain but built it
too late to be useful, because...
- Teach instantiation of static data member definitions not to try
to check an initializer if a previous declaration already had an
initializer. This makes sure that we don't complain about static
const data members with in-class initializers and out-of-line
definitions.
- Move all of the incomplete-type checking logic out of
Sema::FinalizeDeclaratorGroup; it makes more sense in
ActOnUnitializedDecl.

There may still be a few places where we can improve these
diagnostics. I'll address that as a separate commit.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95657 91177308-0d34-0410-b5e6-96231b3b80d8
8.cpp
a5728872c7702ddd09537c95bc3cbd20e1f2fb09 15-Dec-2009 Daniel Dunbar <daniel@zuster.org> Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'.
- 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
xpr.unary/expr.delete/p5.cpp
3.cpp
8.cpp
9.cpp
bb62dcb37c9c8dce64707715051e7523ed14c8e9 13-Nov-2009 Daniel Dunbar <daniel@zuster.org> Add test for expr.delete p5, with a FIXME.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@88678 91177308-0d34-0410-b5e6-96231b3b80d8
xpr.unary/expr.delete/p5.cpp
b656d8823571ad206cd756f58bac941d25765519 09-Oct-2009 Douglas Gregor <dgregor@apple.com> Tests for C++ [expr], from James Porter!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83588 91177308-0d34-0410-b5e6-96231b3b80d8
3.cpp
8.cpp
9.cpp