• Home
  • History
  • Annotate
  • only in /external/clang/test/CXX/
History log of /external/clang/test/CXX/
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
ef8225444452a1486bd721f3285301fe84643b00 21-Jul-2014 Stephen Hines <srhines@google.com> Update Clang for rebase to r212749.

This also fixes a small issue with arm_neon.h not being generated always.

Includes a cherry-pick of:
r213450 - fixes mac-specific header issue
r213126 - removes a default -Bsymbolic on Android

Change-Id: I2a790a0f5d3b2aab11de596fc3a74e7cbc99081d
asic/basic.lookup/basic.lookup.qual/p6-0x.cpp
asic/basic.lookup/basic.lookup.unqual/p15.cpp
asic/basic.scope/basic.scope.local/p2.cpp
asic/basic.start/basic.start.main/p2.cpp
cl.dcl/dcl.spec/dcl.constexpr/p6.cpp
rs/dr10xx.cpp
rs/dr5xx.cpp
rs/dr9xx.cpp
xcept/except.spec/p14-ir.cpp
emp/temp.decls/temp.fct/temp.func.order/p3-0x.cpp
emp/temp.decls/temp.fct/temp.func.order/p3.cpp
emp/temp.param/p14.cpp
6bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89 29-May-2014 Stephen Hines <srhines@google.com> Update Clang for 3.5 rebase (r209713).

Change-Id: I8c9133b0f8f776dc915f270b60f94962e771bc83
asic/basic.lookup/basic.lookup.qual/p6.cpp
cl.dcl/dcl.spec/dcl.fct.spec/p4.cpp
cl.dcl/dcl.spec/dcl.fct.spec/p6.cpp
cl.dcl/dcl.spec/dcl.stc/p10.cpp
cl.decl/dcl.init/dcl.init.list/basic.cpp
cl.decl/dcl.init/dcl.init.list/p3-0x.cpp
cl.decl/dcl.init/dcl.init.list/p7-0x-fixits.cpp
cl.decl/dcl.init/dcl.init.list/p7-0x.cpp
cl.decl/dcl.init/dcl.init.list/p7-cxx11-nowarn.cpp
cl.decl/dcl.meaning/dcl.fct/p6-0x.cpp
cl.decl/dcl.meaning/dcl.fct/p6.cpp
cl.decl/dcl.meaning/p1-0x.cpp
rs/dr2xx.cpp
rs/dr4xx.cpp
rs/dr5xx.cpp
xcept/except.spec/p11.cpp
xpr/expr.const/p2-0x.cpp
xpr/expr.prim/expr.prim.lambda/blocks.mm
ver/over.match/over.match.funcs/over.match.oper/p3.cpp
emp/temp.spec/temp.explicit/p1-emit.cpp
651f13cea278ec967336033dd032faef0e9fc2ec 24-Apr-2014 Stephen Hines <srhines@google.com> Updated to Clang 3.5a.

Change-Id: I8127eb568f674c2e72635b639a3295381fe8af82
asic/basic.lookup/basic.lookup.qual/class.qual/p2.cpp
asic/basic.lookup/basic.lookup.qual/namespace.qual/p2.cpp
asic/basic.start/basic.start.init/p3.cpp
asic/basic.stc/basic.stc.dynamic/basic.stc.dynamic.allocation/p1.cpp
asic/basic.stc/basic.stc.dynamic/basic.stc.dynamic.deallocation/p1.cpp
lass.access/class.access.base/p1.cpp
lass.access/p4.cpp
lass.access/p6.cpp
lass/class.static/class.static.data/p4.cpp
lass/class.union/p8.cpp
cl.dcl/basic.namespace/namespace.udecl/p11.cpp
cl.dcl/basic.namespace/namespace.udecl/p5-cxx0x.cpp
cl.dcl/basic.namespace/namespace.udecl/p6-cxx0x.cpp
cl.dcl/basic.namespace/namespace.udecl/p8-cxx0x.cpp
cl.dcl/dcl.attr/dcl.align/p5.cpp
cl.dcl/dcl.attr/dcl.attr.deprecated/p1.cpp
cl.dcl/dcl.attr/dcl.attr.noreturn/p1.cpp
cl.dcl/dcl.enum/p2.cpp
cl.dcl/dcl.link/p2.cpp
cl.dcl/dcl.link/p7.cpp
cl.dcl/dcl.spec/dcl.constexpr/p1.cpp
cl.dcl/dcl.spec/dcl.constexpr/p2.cpp
cl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p4.cpp
cl.dcl/dcl.spec/dcl.type/dcl.type.simple/p5-cxx0x.cpp
cl.dcl/dcl.spec/dcl.type/p3-0x.cpp
cl.dcl/dcl.spec/dcl.typedef/p2-0x.cpp
cl.decl/dcl.init/dcl.init.list/p7-0x.cpp
cl.decl/dcl.init/dcl.init.list/p7-cxx11-nowarn.cpp
cl.decl/dcl.meaning/dcl.fct/p8.cpp
cl.decl/dcl.meaning/dcl.mptr/p3.cpp
cl.decl/dcl.meaning/dcl.ref/p6-0x.cpp
cl.decl/dcl.meaning/p1-0x.cpp
cl.decl/dcl.meaning/p1.cpp
rs/dr0xx.cpp
rs/dr13xx.cpp
rs/dr14xx.cpp
rs/dr15xx.cpp
rs/dr1xx.cpp
rs/dr2xx.cpp
rs/dr3xx.cpp
rs/dr412.cpp
rs/dr4xx.cpp
rs/dr5xx.cpp
xcept/except.spec/canonical.cpp
xcept/except.spec/p15.cpp
xpr/expr.const/p2-0x.cpp
xpr/expr.const/p3-0x.cpp
xpr/expr.mptr.oper/p5.cpp
xpr/expr.mptr.oper/p6-0x.cpp
xpr/expr.prim/expr.prim.general/p4-0x.cpp
xpr/expr.prim/expr.prim.lambda/blocks.mm
xpr/expr.prim/expr.prim.lambda/generic-lambda-unimplemented-1y.cpp
xpr/expr.prim/expr.prim.lambda/p14.cpp
xpr/expr.prim/expr.prim.lambda/p19.cpp
xpr/expr.prim/expr.prim.lambda/p2-generic-lambda-1y.cpp
xpr/expr.prim/expr.prim.lambda/p5-generic-lambda-1y.cpp
xpr/expr.unary/expr.new/p2-cxx0x.cpp
xpr/expr.unary/expr.unary.op/p4.cpp
xpr/expr.unary/expr.unary.op/p6.cpp
pecial/class.copy/implicit-move-def.cpp
pecial/class.copy/implicit-move.cpp
pecial/class.copy/p11.0x.copy.cpp
pecial/class.copy/p11.0x.move.cpp
pecial/class.copy/p13-0x.cpp
pecial/class.copy/p23-cxx11.cpp
pecial/class.copy/p33-0x.cpp
pecial/class.dtor/p10-0x.cpp
pecial/class.dtor/p3-0x.cpp
pecial/class.dtor/p9.cpp
pecial/class.inhctor/elsewhere.cpp
pecial/class.inhctor/p4.cpp
pecial/class.init/class.base.init/p8-0x.cpp
pecial/class.temporary/p1.cpp
emp/p3.cpp
emp/temp.arg/temp.arg.nontype/p5.cpp
emp/temp.decls/temp.class.spec/p8-1y.cpp
emp/temp.decls/temp.mem/p3.cpp
emp/temp.decls/temp.variadic/fixed-expansion.cpp
emp/temp.decls/temp.variadic/p5.cpp
emp/temp.fct.spec/temp.deduct/temp.deduct.type/p9-0x.cpp
emp/temp.res/temp.local/p3.cpp
emp/temp.spec/cxx1y-variable-template-no-body.cpp
emp/temp.spec/no-body.cpp
emp/temp.spec/temp.expl.spec/p2-0x.cpp
emp/temp.spec/temp.expl.spec/p2.cpp
57907e56191adea0fa870c052054eb0fe0c4681f 28-Nov-2013 Bill Wendling <isanbard@gmail.com> Merging r195827:
------------------------------------------------------------------------
r195827 | majnemer | 2013-11-27 00:20:38 -0800 (Wed, 27 Nov 2013) | 9 lines

Sema: Instantiate local class and their members appropriately

We would fail to instantiate them when the surrounding function was
instantiated. Instantiate the class and add it's members to the list of
pending instantiations, they should be resolved when we are finished
with the function's body.

This fixes PR9685.

------------------------------------------------------------------------


git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_34@195900 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.spec/temp.inst/p1.cpp
7bd67854cfa59699e0efe72244af1578f2a1c09e 26-Nov-2013 Bill Wendling <isanbard@gmail.com> Merging r195620:
------------------------------------------------------------------------
r195620 | rsmith | 2013-11-24 23:07:05 -0800 (Sun, 24 Nov 2013) | 3 lines

Take cv-qualifiers on fields of class type into account when determining
whether a defaulted special member function should be deleted.

------------------------------------------------------------------------


git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_34@195719 91177308-0d34-0410-b5e6-96231b3b80d8
xcept/except.spec/p14.cpp
pecial/class.copy/p11.0x.copy.cpp
pecial/class.copy/p11.0x.move.cpp
pecial/class.copy/p23-cxx11.cpp
f696538f5e79a285cc453eba2eacdb3edab16cca 18-Nov-2013 NAKAMURA Takumi <geek4civic@gmail.com> clang/test/CXX/drs/dr2xx.cpp: Suppress this for targeting LLP64 due to __SIZE_TYPE__.

Line 559: 'long long' is a C++11 extension
Line 566: 'long long' is a C++11 extension
Line 674: 'long long' is a C++11 extension

See also PR13819.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@195005 91177308-0d34-0410-b5e6-96231b3b80d8
rs/dr2xx.cpp
7b633339f3f17d6817bc664332008996c51badd2 18-Nov-2013 Richard Smith <richard-llvm@metafoo.co.uk> Tests for core issues 251-270.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194989 91177308-0d34-0410-b5e6-96231b3b80d8
rs/dr2xx.cpp
e3a404411fe651097024edece9a72afeef5f6ac3 17-Nov-2013 Richard Smith <richard-llvm@metafoo.co.uk> Tests for core issue 241-250.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194951 91177308-0d34-0410-b5e6-96231b3b80d8
rs/dr0xx.cpp
rs/dr2xx.cpp
1a2dc26cc17c54b8864e7a53a57ae5b3b1324a03 17-Nov-2013 Richard Smith <richard-llvm@metafoo.co.uk> Tests for core issues 224-240.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194946 91177308-0d34-0410-b5e6-96231b3b80d8
rs/dr2xx.cpp
ad40edabcb1a6cf05c17c31e66842e3cbb24fde9 15-Nov-2013 Richard Smith <richard-llvm@metafoo.co.uk> Tests for core issue 216-223.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194795 91177308-0d34-0410-b5e6-96231b3b80d8
rs/dr2xx.cpp
418220b209ed67a5cc6802d367a9a994d7225e04 14-Nov-2013 Richard Smith <richard-llvm@metafoo.co.uk> DR408: If a static data member of incomplete array type is declared in a class
template, that member has a dependent type (even if we can see the definition
of the member of the primary template), because the array size could change in
a member specialization.

Patch by Karthik Bhat!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194740 91177308-0d34-0410-b5e6-96231b3b80d8
rs/dr4xx.cpp
142ab06ffb2ec286917554aa5d945323a1ebf359 14-Nov-2013 Serge Pavlov <sepavloff@gmail.com> Added warning on structures/unions that are empty or contain only
bit fields of zero size. Warnings are generated in C++ mode and if
only such type is defined inside extern "C" block.
The patch fixed PR5065.

Differential Revision: http://llvm-reviews.chandlerc.com/D2151


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194653 91177308-0d34-0410-b5e6-96231b3b80d8
asic/basic.lookup/basic.lookup.argdep/p2.cpp
2c1721f12297bb881f7f9deb383fe6616d835272 12-Nov-2013 Richard Smith <richard-llvm@metafoo.co.uk> Tests for core issue 201-215.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194458 91177308-0d34-0410-b5e6-96231b3b80d8
rs/dr2xx.cpp
ce6426feda94ca716ee7743b71961850740eb08d 08-Nov-2013 Richard Smith <richard-llvm@metafoo.co.uk> Issue a diagnostic if we see a templated friend declaration that we do not
support.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194273 91177308-0d34-0410-b5e6-96231b3b80d8
lass.access/class.friend/p3-cxx0x.cpp
emp/temp.decls/temp.friend/p5.cpp
e83b4eb1cf3dd67f3f3700af3e498641268b50c7 08-Nov-2013 NAKAMURA Takumi <geek4civic@gmail.com> clang/test/CXX/drs/dr1xx.cpp: Add explicit triple x86_64-unknown-unknown to satisfy check7a and check8a since r194240.

For i686 targets and LLP64 targets, we can see;
error: 'error' diagnostics seen but not expected:
File clang/test/CXX/drs/dr1xx.cpp Line 761: 'check7a' declared as an array with a negative size
File clang/test/CXX/drs/dr1xx.cpp Line 765: 'check8a' declared as an array with a negative size
2 errors generated.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194246 91177308-0d34-0410-b5e6-96231b3b80d8
rs/dr1xx.cpp
e9a5b3871f3d58fa226910fd8123c98fc8bc6c67 08-Nov-2013 Richard Smith <richard-llvm@metafoo.co.uk> Tests for core issue 170-200.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194240 91177308-0d34-0410-b5e6-96231b3b80d8
rs/dr1xx.cpp
rs/dr2xx.cpp
fed2603a98c8898cff5dec4b935a00bb9f4d8ecc 07-Nov-2013 Richard Smith <richard-llvm@metafoo.co.uk> Tests for CWG issue 165-170.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194215 91177308-0d34-0410-b5e6-96231b3b80d8
rs/dr1xx.cpp
cb82c8975fccdd0ae97c70c24e860d1383d81fd0 07-Nov-2013 Richard Smith <richard-llvm@metafoo.co.uk> Tests for DR150 - DR165.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194192 91177308-0d34-0410-b5e6-96231b3b80d8
rs/dr1xx.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/expr.prim/expr.prim.lambda/generic-lambda-unimplemented-1y.cpp
xpr/expr.prim/expr.prim.lambda/p2-generic-lambda-1y.cpp
xpr/expr.prim/expr.prim.lambda/p5-generic-lambda-1y.cpp
33b1f634e074835a1b49c23d2b7674161fef1762 04-Nov-2013 Richard Smith <richard-llvm@metafoo.co.uk> Issue a diagnostic if an implicitly-defined move assignment operator would move
the same virtual base class multiple times (and the move assignment is used,
and the move assignment for the virtual base is not trivial).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193977 91177308-0d34-0410-b5e6-96231b3b80d8
pecial/class.copy/implicit-move-def.cpp
pecial/class.copy/implicit-move.cpp
743cbb91499e138a63a398c6515667905f1b3be8 04-Nov-2013 Richard Smith <richard-llvm@metafoo.co.uk> Implement final resolution of DR1402: implicitly-declared move operators that
would be deleted are still declared, but are ignored by overload resolution.

Also, don't delete such members if a subobject has no corresponding move
operation and a non-trivial copy. This causes us to implicitly declare move
operations in more cases, but risks move-assigning virtual bases multiple
times in some circumstances (a warning for that is to follow).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193969 91177308-0d34-0410-b5e6-96231b3b80d8
lass.derived/class.abstract/p16.cpp
rs/dr1xx.cpp
pecial/class.copy/implicit-move.cpp
pecial/class.copy/p12-0x.cpp
pecial/class.copy/p23-cxx11.cpp
190d1af17608f05bc9792af21fd0b4e20e438588 30-Oct-2013 Richard Smith <richard-llvm@metafoo.co.uk> PR17731: When determining whether a tag and a non-tag were declared in the same
scope, be careful about function-scope declarations (which are not declared in
their semantic context).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193671 91177308-0d34-0410-b5e6-96231b3b80d8
asic/basic.scope/basic.scope.hiding/p2.cpp
099791143ba548bf0a228da0d268b463a3507929 26-Oct-2013 David Majnemer <david.majnemer@gmail.com> Sema: Emit a nicer diagnostic when IndirectFieldDecls show up inappropriately in non-type template arguments


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193462 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.arg/temp.arg.nontype/p1.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/expr.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/expr.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/expr.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/expr.prim/expr.prim.lambda/generic-lambda-unimplemented-1y.cpp
588a51a471b4cb23613e8183e05d2d193d2ab813 22-Oct-2013 David Majnemer <david.majnemer@gmail.com> Sema: Do not allow template declarations inside local classes

Summary:
Enforce the rule in C++11 [temp.mem]p2 that local classes cannot have
member templates.

This fixes PR16947.

N.B. C++14 has slightly different wording to afford generic lambdas
declared inside of functions.

Fun fact: Some formulations of local classes with member templates
would cause clang to crash during Itanium mangling, such as the
following:

void outer_mem() {
struct Inner {
template <typename = void>
struct InnerTemplateClass {
static void itc_mem() {}
};
};
Inner::InnerTemplateClass<>::itc_mem();
}

Reviewers: eli.friedman, rsmith, doug.gregor, faisalv

Reviewed By: doug.gregor

CC: cfe-commits, ygao

Differential Revision: http://llvm-reviews.chandlerc.com/D1866

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193144 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.mem/p2.cpp
b5c7768a74936d4e2c7a484570a638cb74702d8b 19-Oct-2013 Kaelyn Uhrain <rikka@google.com> Allow CorrectTypo to replace CXXScopeSpecifiers that refer to classes.

Now that CorrectTypo knows how to correctly search classes for typo
correction candidates, there is no good reason to only replace an
existing CXXScopeSpecifier if it refers to a namespace. While the actual
enablement was a matter of changing a single comparison, the fallout
from enabling the functionality required a lot more code changes
(including my two previous commits).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193020 91177308-0d34-0410-b5e6-96231b3b80d8
lass.access/class.friend/p1.cpp
lass.access/p6.cpp
emp/temp.decls/temp.class/temp.mem.enum/p1.cpp
49ef481bc1b0b0f757ba6ac1ad6d0425390e7654 16-Oct-2013 Richard Smith <richard-llvm@metafoo.co.uk> PR17592: Ensure we diagnose shadowing a template parameter with a local extern
declaration.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@192846 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.res/temp.local/p6.cpp
b79b17b67f2c0de8fd343fdd070e5ccbfe20d602 15-Oct-2013 Richard Smith <richard-llvm@metafoo.co.uk> PR17567: Improve diagnostic for a mistyped constructor name. If we see something
that looks like a function declaration, except that it's missing a return type,
try typo-correcting it to the relevant constructor name.

In passing, fix a bug where the missing-type-specifier recovery codepath would
drop a preceding scope specifier on the floor, leading to follow-on diagnostics
and incorrect recovery for the auto-in-c++98 hack.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@192644 91177308-0d34-0410-b5e6-96231b3b80d8
rs/dr1xx.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/expr.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
cl.dcl/dcl.attr/dcl.align/p7.cpp
xpr/expr.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
cl.dcl/dcl.attr/dcl.align/p7.cpp
xpr/expr.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
cl.dcl/dcl.attr/dcl.align/p7.cpp
xpr/expr.unary/expr.sizeof/p1.cpp
c50ffca69af980af021384e087a81ae2ff7b9e26 08-Oct-2013 Richard Smith <richard-llvm@metafoo.co.uk> Add a triple to unbreak buildbots where size_t is not 'unsigned long'.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@192140 91177308-0d34-0410-b5e6-96231b3b80d8
ex/lex.literal/lex.ext/p5.cpp
ex/lex.literal/lex.ext/p7.cpp
b328e29173d15baf3f44ccdc9c310ee741caaaf7 07-Oct-2013 Richard Smith <richard-llvm@metafoo.co.uk> Add support for WG21 N3599 (literal operator template for strings) as a GNU
extension. The GCC folks have decided to support this even though the standard
committee have not yet approved this feature.

Patch by Hristo Venev!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@192128 91177308-0d34-0410-b5e6-96231b3b80d8
ex/lex.literal/lex.ext/p11.cpp
ex/lex.literal/lex.ext/p12.cpp
ex/lex.literal/lex.ext/p5.cpp
ex/lex.literal/lex.ext/p7.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/expr.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/expr.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/expr.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/expr.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/expr.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/expr.prim/expr.prim.lambda/p23.cpp
xpr/expr.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/expr.prim/expr.prim.lambda/p11-1y.cpp
xpr/expr.prim/expr.prim.lambda/p23.cpp
bb791699c095edc3e8cfaeaba7a0fb513f8c8cf4 28-Sep-2013 Chandler Carruth <chandlerc@gmail.com> Fix a bug where we failed to diagnose class template specialization
uses.

This fixes one of the two remaining failures to implement [[deprecated]]
as specified for C++14.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191572 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/dcl.attr/dcl.attr.deprecated/p1.cpp
998894bf0b00f310e14751003ed5eaedd8df9b4b 27-Sep-2013 Chandler Carruth <chandlerc@gmail.com> Implement N3760, support for the [[deprecated]] attribute.

This motion appears to have consensus in the C++ committee and is
expected to be voted into the C++14 draft tomorrow during the formal
vote.

No extension warning in C++11 as attributes not specified in the
standard using the standard syntax in C++11 have implementation defined
meaning, and we define the meaning proposed for C++14.

There is one bug exposed as we do not warn on a deprecated template
specialization. I've left a FIXME in the test case and will dig into
that next.

Also, I will add a few more exhaustive test cases of the other features
specified for this attribute in a follow-up commit.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191550 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/dcl.attr/dcl.attr.deprecated/p1.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/expr.prim/expr.prim.lambda/generic-lambda-unimplemented-1y.cpp
xpr/expr.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
cl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p3-generic-lambda-1y.cpp
xpr/expr.prim/expr.prim.lambda/generic-lambda-unimplemented-1y.cpp
xpr/expr.prim/expr.prim.lambda/p2-generic-lambda-1y.cpp
xpr/expr.prim/expr.prim.lambda/p4-1y.cpp
xpr/expr.prim/expr.prim.lambda/p4.cpp
xpr/expr.prim/expr.prim.lambda/p5-generic-lambda-1y.cpp
3d9559b91c00757b296354cc6ca93e899266c7d2 26-Sep-2013 Kaelyn Uhrain <rikka@google.com> Teach typo correction to look inside of classes like it does namespaces.

Unlike with namespaces, searching inside of classes requires also
checking the access to correction candidates (i.e. don't suggest a
correction to a private class member for a correction occurring outside
that class and its methods or friends).

Included is a small (one line) fix for a bug, that was uncovered while
cleaning up the unit tests, where the decls from a TypoCorrection candidate
were preserved in new TypoCorrection candidates that are derived (copied)
from the old TypoCorrection--notably when creating a new candidate by
changing the NestedNameSpecifier associated with the base idenitifer.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191449 91177308-0d34-0410-b5e6-96231b3b80d8
asic/basic.lookup/basic.lookup.argdep/p2.cpp
lass/class.nested.type/p1.cpp
cl.decl/dcl.meaning/dcl.fct.default/p10.cpp
0302214d4a10ed328b1ec2de932f112881e9c217 24-Sep-2013 Richard Smith <richard-llvm@metafoo.co.uk> Hopefully unbreak bots which are seeing an assert in this test. Temporary, real
fix to come once I've tracked down the problem (which is pre-existing and not
related to the change which introduced this test).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191279 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.class.spec/p8-1y.cpp
ecbce69e354c77bf2d359111bad0c77c516e16f0 24-Sep-2013 Richard Smith <richard-llvm@metafoo.co.uk> Implement restriction that a partial specialization must actually specialize
something, for variable templates.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191278 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.class.spec/p8-1y.cpp
ef8f90caa14d85cffba2fea4b6bd425c3b22eea7 20-Sep-2013 Richard Trieu <rtrieu@google.com> Modify the uninitialized field visitor to detect uninitialized use across the
fields in the class. This allows a better checking of member intiailizers and
in class initializers in regards to initialization ordering.

For instance, this code will now produce warnings:

class A {
int x;
int y;
A() : x(y) {} // y is initialized after x, warn here
A(int): y(x) {} // default initialization of leaves x uninitialized, warn here
};

Several test cases were updated with -Wno-uninitialized to silence this warning.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191068 91177308-0d34-0410-b5e6-96231b3b80d8
cl.decl/dcl.init/dcl.init.aggr/p7.cpp
a41c97a5d1912ffd184381d269fd8e5a25ee5e59 20-Sep-2013 Richard Smith <richard-llvm@metafoo.co.uk> Switch the semantic DeclContext for a block-scope declaration of a function or
variable from being the function to being the enclosing namespace scope (in
C++) or the TU (in C). This allows us to fix a selection of related issues
where we would build incorrect redeclaration chains for such declarations, and
fail to notice type mismatches.

Such declarations are put into a new IdentifierNamespace, IDNS_LocalExtern,
which is only found when searching scopes, and not found when searching
DeclContexts. Such a declaration is only made visible in its DeclContext if
there are no non-LocalExtern declarations.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191064 91177308-0d34-0410-b5e6-96231b3b80d8
asic/basic.link/p7.cpp
cl.decl/dcl.meaning/dcl.array/p3.cpp
rs/dr0xx.cpp
8e6557e57e2b88fd3de8a87e53e30c774497f51d 18-Sep-2013 Richard Smith <richard-llvm@metafoo.co.uk> Fix accepts-invalid if a variable template explicit instantiation is missing an
argument list, but could be instantiated with argument list of <>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@190913 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.spec/cxx1y-variable-template-no-body.cpp
66118c215183dec714cbbdec8060497675cebcac 11-Sep-2013 Richard Smith <richard-llvm@metafoo.co.uk> PR17075: When performing partial ordering of a member function against a
non-member function, the number of arguments in the two candidate calls
will be different (the non-member call will have one extra argument).
We used to get confused by this, and fail to compare the last argument
when testing whether the member is better, resulting in us always
thinking it is, even if the non-member is more specialized in the last
argument.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@190470 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.fct/temp.func.order/p3-0x.cpp
130fcc8097ac79c770d480765d4f79b428b285b8 06-Sep-2013 Eli Friedman <eli.friedman@gmail.com> Preserve exception specs in function decl merging.

Exception specs are not part of the canonical type, but we shouldn't
drop them just because we merged a noreturn attribute.

Fixes PR17110.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@190206 91177308-0d34-0410-b5e6-96231b3b80d8
xcept/except.spec/p4.cpp
dae9271c2c32527fea8b01953912e214eadc548e 06-Sep-2013 Eli Friedman <eli.friedman@gmail.com> Improve error for "override" + non-virtual func.

Consider something like the following:

struct X {
virtual void foo(float x);
};
struct Y : X {
void foo(double x) override;
};

The error is almost certainly that Y::foo() has the wrong signature,
rather than incorrect usage of the override keyword. This patch
adds an appropriate diagnostic for that case.

Fixes <rdar://problem/14785106>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@190109 91177308-0d34-0410-b5e6-96231b3b80d8
lass.derived/class.virtual/p3-0x.cpp
3bf48ca9c9f924073cab503799891f539d041d12 04-Sep-2013 Rafael Espindola <rafael.espindola@gmail.com> Disable llvm optimizations, but keep -O1 to test available_externally.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@189919 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.spec/temp.explicit/p9-linkage.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
cl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p4.cpp
cl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p6.cpp
cl.decl/dcl.meaning/dcl.fct/p2-cxx0x.cpp
xpr/expr.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
cl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p3-generic-lambda-1y.cpp
xpr/expr.prim/expr.prim.lambda/generic-lambda-unimplemented-1y.cpp
xpr/expr.prim/expr.prim.lambda/p2-generic-lambda-1y.cpp
xpr/expr.prim/expr.prim.lambda/p4-1y.cpp
xpr/expr.prim/expr.prim.lambda/p4.cpp
xpr/expr.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
cl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p3-generic-lambda-1y.cpp
xpr/expr.prim/expr.prim.lambda/generic-lambda-unimplemented-1y.cpp
xpr/expr.prim/expr.prim.lambda/p2-generic-lambda-1y.cpp
xpr/expr.prim/expr.prim.lambda/p4-1y.cpp
xpr/expr.prim/expr.prim.lambda/p4.cpp
xpr/expr.prim/expr.prim.lambda/p5-generic-lambda-1y.cpp
4a91989b2dc901a4998fa5443aeba0276a8cfaa6 14-Aug-2013 Larisse Voufo <lvoufo@google.com> Bug fix: disallow a variable template to be redeclared as a non-templated variable

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@188350 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.spec/cxx1y-variable-template-no-body.cpp
emp/temp.spec/temp.expl.spec/examples.cpp
72a36a14b10c18bc72bf0472dc29e86327615c26 14-Aug-2013 Richard Smith <richard-llvm@metafoo.co.uk> Don't produce duplicate notes if we have deduction failure notes when resolving
the address of an overloaded function template.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@188334 91177308-0d34-0410-b5e6-96231b3b80d8
ver/over.over/p2.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/expr.post/expr.call/p7-0x.cpp
xpr/expr.prim/expr.prim.lambda/p2.cpp
xpr/expr.unary/expr.sizeof/p1.cpp
dd9459f8869f66409f7ea429053b453e33f6499c 13-Aug-2013 Richard Smith <richard-llvm@metafoo.co.uk> Fix implementation of C11 6.2.7/4 and C++11 [dcl.array]p3:

When a local extern declaration redeclares some other entity, the type of that
entity is merged with the prior type if the prior declaration is visible (in C)
or is declared in the same scope (in C++).

- Make LookupRedeclarationWithLinkage actually work in C++, use it in the right
set of cases, and make it track whether it found a shadowed declaration.
- Track whether we found a declaration in the same scope (for C++) including
across serialization and template instantiation.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@188307 91177308-0d34-0410-b5e6-96231b3b80d8
asic/basic.link/p6.cpp
cl.decl/dcl.meaning/dcl.array/p3.cpp
4e9686b1f9947f1747b4f4316deb2087a7f56282 09-Aug-2013 Richard Smith <richard-llvm@metafoo.co.uk> Implement [class.friend]p11's special name lookup rules for friend declarations
of local classes. We were previously handling this by performing qualified
lookup within a function declaration(!!); replace it with the proper scope
lookup.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@188050 91177308-0d34-0410-b5e6-96231b3b80d8
lass.access/class.friend/p11.cpp
pecial/class.copy/implicit-move.cpp
ef4579cda09b73e3d4d98af48201da25adc29326 06-Aug-2013 Larisse Voufo <lvoufo@google.com> Started implementing variable templates. Top level declarations should be fully supported, up to some limitations documented as FIXMEs or TODO. Static data member templates work very partially. Static data member templates of class templates need particular attention...

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@187762 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.class/temp.static/p1.cpp
emp/temp.spec/cxx1y-variable-template-no-body.cpp
emp/temp.spec/temp.expl.spec/examples.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/expr.post/expr.call/p7-0x.cpp
3cb443636fb3ca457994d91527a22c5b159e5169 05-Aug-2013 Serge Pavlov <sepavloff@gmail.com> Regression test for PR12699


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@187734 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.variadic/sizeofpack.cpp
576a9af150e4ddb34fd9cbede6eb5e3cf2bae9c8 01-Aug-2013 David Majnemer <david.majnemer@gmail.com> Sema: Diagnose explicitly bound unresolved member expressions decaying into pointers to function type

We would disallow the case where the overloaded member expression is
coming from an address-of operator but we wouldn't issue any diagnostics
when the overloaded member expression comes by way of a function to
pointer decay cast.

Clang's implementation of DR61 is now seemingly complete.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@187559 91177308-0d34-0410-b5e6-96231b3b80d8
rs/dr0xx.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/expr.prim/expr.prim.lambda/p4.cpp
6931b4da1f586d72d26773b57c55fb18da641566 26-Jul-2013 Eli Friedman <eli.friedman@gmail.com> Move friend warning into CXX11 warning group.

Also, fix the wording to reflect this.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@187171 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/dcl.spec/dcl.type/dcl.type.elab/p3.cpp
b3da613977f6b77dee2b382eeff5713168a4ca18 23-Jul-2013 Eli Friedman <eli.friedman@gmail.com> Integers which are too large should be an error.

Switch some warnings over to errors which should never have been warnings
in the first place. (Also, a minor fix to the preprocessor rules for
integer literals while I'm here.)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186903 91177308-0d34-0410-b5e6-96231b3b80d8
ex/lex.literal/lex.ext/p3.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
cl.dcl/dcl.spec/dcl.constexpr/p1.cpp
xpr/expr.const/p3-0x.cpp
ver/over.over/p2.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
cl.dcl/dcl.spec/dcl.constexpr/p1.cpp
xpr/expr.const/p3-0x.cpp
ver/over.over/p2.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
cl.dcl/dcl.spec/dcl.constexpr/p1.cpp
xpr/expr.const/p3-0x.cpp
ver/over.over/p2.cpp
cd37a0b6bbd8d46af116c72537e2129e4a077e5e 19-Jul-2013 Eli Friedman <eli.friedman@gmail.com> Fix crash-on-invalid with inheriting constructor.

Fixes PR16656.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186631 91177308-0d34-0410-b5e6-96231b3b80d8
pecial/class.inhctor/p8.cpp
c4ef9485252c6a408acb70aac5a153dcd9d860c7 19-Jul-2013 Eli Friedman <eli.friedman@gmail.com> Clean up diagnostics for inheriting constructors.

No new diagnostics, just better wording and notes pointing at more
relevant locations.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186629 91177308-0d34-0410-b5e6-96231b3b80d8
pecial/class.inhctor/p1.cpp
pecial/class.inhctor/p4.cpp
22050f25e34ba0cd21ee2dc3d765951c48e27cde 18-Jul-2013 Richard Smith <richard-llvm@metafoo.co.uk> Reinstate r186040, with additional fixes and more test coverage (reverted in
r186331).

Original commit log:
If we friend a declaration twice, that should not make it visible to
name lookup in the surrounding context. Slightly rework how we handle
friend declarations to inherit the visibility of the prior
declaration, rather than setting a friend declaration to be visible
whenever there was a prior declaration.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186546 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.friend/p4.cpp
52c2575fc77a51f36129be89d1a0a90e31617a57 15-Jul-2013 Chandler Carruth <chandlerc@gmail.com> Re-revert r86040, which was un-reverted in r186199.

This breaks the build of basic patterns with repeated friend
declarations. See the added test case in SemaCXX/friend.cpp or the test
case reported to the original commit log.

Original commit log:
If we friend a declaration twice, that should not make it visible to
name lookup in the surrounding context. Slightly rework how we handle
friend declarations to inherit the visibility of the prior
declaration, rather than setting a friend declaration to be visible
whenever there was a prior declaration.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186331 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.friend/p4.cpp
dc49d523db70a1c9005b7c09de80b22ccb1ed6a4 15-Jul-2013 Serge Pavlov <sepavloff@gmail.com> Fix to PR12262 - assertion when substituting explicit template arguments
does not substitute a sizeof-pack expression.
The solution is proposed by Richard Smith.
Differential Revision: http://llvm-reviews.chandlerc.com/D869


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186306 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.variadic/sizeofpack.cpp
226399ce18cdcbb1e83af7c5e644bdabb9d4f2f8 13-Jul-2013 David Blaikie <dblaikie@gmail.com> Correctly classify pack expansions as NON_CANONICAL_UNLESS_DEPENDENT

Test coverage for non-dependent pack expansions doesn't demonstrate a
failure prior to this patch (a follow-up commit improving debug info
will cover this commit specifically) but covers a related hole in our
test coverage.

Reviewed by Richard Smith & Eli Friedman.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186261 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.alias/p3.cpp
f9e65a274d4e5c5a45503efc81da43be76503983 12-Jul-2013 Richard Smith <richard-llvm@metafoo.co.uk> Unrevert r186040, reverted in r186185, with fix for PR16597.

Original commit log:
If we friend a declaration twice, that should not make it visible to
name lookup in the surrounding context. Slightly rework how we handle
friend declarations to inherit the visibility of the prior
declaration, rather than setting a friend declaration to be visible
whenever there was a prior declaration.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186199 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.friend/p4.cpp
1afa611e36e0ab23dd3cde4bbe5aa74ceb7d77c5 12-Jul-2013 Chandler Carruth <chandlerc@gmail.com> Revert r186040 to fix PR16597 while Richard investigates what the best
fix is.

Original commit log:
If we friend a declaration twice, that should not make it visible to
name lookup in the surrounding context. Slightly rework how we handle
friend declarations to inherit the visibility of the prior
declaration, rather than setting a friend declaration to be visible
whenever there was a prior declaration.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186185 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.friend/p4.cpp
433a13d0cdb1c48b828fe5bfb6a835c58e1e758b 11-Jul-2013 Richard Smith <richard-llvm@metafoo.co.uk> If we friend a declaration twice, that should not make it visible to name
lookup in the surrounding context. Slightly rework how we handle friend
declarations to inherit the visibility of the prior declaration, rather
than setting a friend declaration to be visible whenever there was a prior
declaration.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186040 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.friend/p4.cpp
bcd0650c1e50a2e73b11717731e074a1ac2ac5ba 08-Jul-2013 David Majnemer <david.majnemer@gmail.com> Sema: Do not merge new decls with invalid, old decls

Sema::MergeFunctionDecl attempts merging two decls even if the old decl
is invalid. This can lead to interesting circumstances where we
successfully merge the decls but the result makes no sense.

Take the following for example:

template <typename T>
int main(void);

int main(void);

Sema will not consider these to be overloads of the same name because
main can't be overloaded, which means that this must be a redeclaration.

In this case the templated decl is compatible with the non-templated
decl allowing the Sema::CheckFunctionDeclaration machinery to move on
and do bizarre things like setting the previous decl of a non-templated
decl to a templated decl!

The way I see it, we should just bail from MergeFunctionDecl if the old
decl is invalid.

This fixes PR16531.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185779 91177308-0d34-0410-b5e6-96231b3b80d8
asic/basic.start/basic.start.main/p2.cpp
732277ac26b0ad6cf6c78a039f8f504c2203261f 07-Jul-2013 Richard Smith <richard-llvm@metafoo.co.uk> Rename test to match C++1y paragraph number per N3690, and add additional test
case inspired by a stackoverflow question.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185772 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p6-1y.cpp
cl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p7-1y.cpp
cl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p7.cpp
c371db6b1dac65d61c8952b6198cc970a9e25ee4 06-Jul-2013 David Majnemer <david.majnemer@gmail.com> Sema: Fix a crash when main is redeclared as a function-template.

This boils down to us sending invalid function decls to
CheckFunctionDeclaration becauswe we did not consider that CheckMain
could cause the decl to be invalid. Instead, interogate the new decl's
main-validity and *then* send it over to get CheckFunctionDeclaration'd
if it was still valid after calling CheckMain.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185745 91177308-0d34-0410-b5e6-96231b3b80d8
asic/basic.start/basic.start.main/p2.cpp
9e805906ec1ba090bb6aebe630458ff817aaf995 04-Jul-2013 Rafael Espindola <rafael.espindola@gmail.com> Replace void with int to make this a valid C++ file.

The test was passing because clang would still print the ast before exiting
with an error. Since that didn't seem to be the intent of the test, I change
the test instead of adding 'not' to the command line.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185634 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/dcl.link/p7-2.cpp
b2567ddad9a1142d7224e5363029d640e8f4f59d 03-Jul-2013 Kaelyn Uhrain <rikka@google.com> Allow typo correction to try removing nested name specifiers.

The removal is tried by retrying the failed lookup of a correction
candidate with either the MemberContext or SS (CXXScopeSpecifier) or
both set to NULL if they weren't already. If the candidate identifier
is then looked up successfully, make a note in the candidate that the
SourceRange should include any existing nested name specifier even if
the candidate isn't adding a different one (i.e. the candidate has a
NULL NestedNameSpecifier).

Also tweak the diagnostic messages to differentiate between a suggestion
that just replaces the identifer but leaves the existing nested name
specifier intact and one that replaces the entire qualified identifier,
in cases where the suggested replacement is unqualified.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185487 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/basic.namespace/namespace.def/p8.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/expr.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/expr.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/expr.prim/expr.prim.lambda/blocks-irgen.mm
aa4bc18240c03b5ed7952aa5e013c081f8733ed3 30-Jun-2013 Richard Smith <richard-llvm@metafoo.co.uk> Reinstate r185229, reverted in r185256, with a tweak: further ignore the
standard's rule that an extern "C" declaration conflicts with any entity in the
global scope with the same name. Now we only care if the global scope entity is
a variable declaration (and so might have the same mangled name as the extern
"C" declaration). This has been reported as a standard defect.

Original commit message:

PR7927, PR16247: Reimplement handling of matching extern "C" declarations
across scopes.

When we declare an extern "C" name that is not a redeclaration of an entity in
the same scope, check whether it redeclares some extern "C" entity from another
scope, and if not, check whether it conflicts with a (non-extern-"C") entity in
the translation unit.

When we declare a name in the translation unit that is not a redeclaration,
check whether it conflicts with any extern "C" entities (possibly from other
scopes).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185281 91177308-0d34-0410-b5e6-96231b3b80d8
lass.access/class.friend/p1.cpp
6e428a446ed7cc170346430afa7be54e83b2d28c 29-Jun-2013 Timur Iskhodzhanov <timurrrr@google.com> Revert r185229 as it breaks compilation of <windows.h>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185256 91177308-0d34-0410-b5e6-96231b3b80d8
lass.access/class.friend/p1.cpp
5eab8d733ce7867fda4e6d5f5afa6dfe8a105c79 29-Jun-2013 Richard Smith <richard-llvm@metafoo.co.uk> PR7927, PR16247: Reimplement handling of matching extern "C" declarations
across scopes.

When we declare an extern "C" name that is not a redeclaration of an entity in
the same scope, check whether it redeclares some extern "C" entity from another
scope, and if not, check whether it conflicts with a (non-extern-"C") entity in
the translation unit.

When we declare a name in the translation unit that is not a redeclaration,
check whether it conflicts with any extern "C" entities (possibly from other
scopes).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185229 91177308-0d34-0410-b5e6-96231b3b80d8
lass.access/class.friend/p1.cpp
f6a144f5991c6b29622a31fdab86adede0648d12 26-Jun-2013 David Majnemer <david.majnemer@gmail.com> Implement DR136

Friend declarations that specify a default argument must be a definition
and the only declaration in the translation unit.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184889 91177308-0d34-0410-b5e6-96231b3b80d8
rs/dr1xx.cpp
ba5da6e7774b175a961b8e02c246f5272cf07125 26-Jun-2013 Richard Smith <richard-llvm@metafoo.co.uk> Missing test update from r184884.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184885 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.friend/p5.cpp
87b12b2e92c1670e551d66938a4c0a055b18b03a 26-Jun-2013 David Majnemer <david.majnemer@gmail.com> Implement DR21

A default template-argument shall not be specified in a friend template
declaration.

Interestingly, we properly handled default template arguments on friend
class members but not on just friend classes.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184882 91177308-0d34-0410-b5e6-96231b3b80d8
rs/dr0xx.cpp
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/expr.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/expr.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/expr.prim/expr.prim.lambda/blocks-irgen.mm
8d90b4ab994c48c4b6d53122282dc93ac722bfc7 24-Jun-2013 Kaelyn Uhrain <rikka@google.com> Add the global namespace (the "::" namespace specifier) to the list of
namespaces to try for potential typo corrections.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184762 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/basic.namespace/namespace.def/p8.cpp
35178dc09d97bb2e0612813def09833866e3ad82 22-Jun-2013 David Blaikie <dblaikie@gmail.com> DebugInfo: Support (using GNU extensions) for template template parameters and parameter packs

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184644 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.variadic/p2.cpp
2f686697187e8834346b7924797d44c978252ec6 22-Jun-2013 David Majnemer <david.majnemer@gmail.com> Revert r184401 which reverted r183462.

The problem with r183462 was that we assumed that a diagnostic id of
zero would be silent.

This small correction to CheckDerivedToBaseConversion changes it's
behavior to omit the diagnostic when given a diagnostic id of zero.

This fix passes the test case added in r184402.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184631 91177308-0d34-0410-b5e6-96231b3b80d8
rs/dr0xx.cpp
4447af930ab888a3a37cadaa2e638f54bbd9c2ea 21-Jun-2013 Larisse Voufo <lvoufo@google.com> Extend template instantiation bug fix (r184503) with fixit test

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184577 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.spec/no-body.cpp
472e66e9d32e587a028bc676aa63bd7137f3d4d4 21-Jun-2013 Larisse Voufo <lvoufo@google.com> Add basic fixit test to template instantiation bug fix (r184503)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184559 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.spec/no-body.cpp
7c64ef05e179d29646030e9d453081844ecc537a 21-Jun-2013 Larisse Voufo <lvoufo@google.com> Bug Fix: Template explicit instantiations should not have definitions (FixIts yet to be tested.)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184503 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.spec/no-body.cpp
8ff7e32f9480bf00d8d8476c650907853d1cc354 21-Jun-2013 Eli Friedman <eli.friedman@gmail.com> Add a couple more tests.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184501 91177308-0d34-0410-b5e6-96231b3b80d8
lass.access/class.friend/p6.cpp
emp/temp.decls/temp.variadic/p5.cpp
fc5335dd8ead65b7dc1dedd75ed32f9e74f229d0 20-Jun-2013 Chandler Carruth <chandlerc@gmail.com> Add a regression test for PR16370 next to the dr7 test case since they
seem closely related. (I'm happy to move this if others have a better
idea of where to put it.)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184402 91177308-0d34-0410-b5e6-96231b3b80d8
rs/dr0xx.cpp
62341d3bde21c85405318950ed8d26b6b3e36544 20-Jun-2013 Chandler Carruth <chandlerc@gmail.com> Temporarily revert r183462: "Implement DR7"

This fixes PR16370, I'll add the test case in a follow-up commit.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184401 91177308-0d34-0410-b5e6-96231b3b80d8
rs/dr0xx.cpp
662f41bd9d4bfb4aebaba05e6043a6ff5f0dc2ff 18-Jun-2013 Richard Smith <richard-llvm@metafoo.co.uk> DR14, DR101, and part of DR1: fix handling of extern "C" declarations in
namespaces, by treating them just like we treat extern "C" declarations in
function scope.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184223 91177308-0d34-0410-b5e6-96231b3b80d8
rs/dr0xx.cpp
rs/dr1xx.cpp
3ed4d1cbaad763c103771bdefb8b986a08f165fc 18-Jun-2013 Richard Smith <richard-llvm@metafoo.co.uk> PR14503: Don't assert if a constexpr constructor temploid instantiates to a
constructor that does not initialize all members, and that constructor is used
to initialize a global.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184211 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/dcl.spec/dcl.constexpr/p4.cpp
5c8a92ef245c773fa56e66a8c88ae9393eea2fb6 17-Jun-2013 Richard Smith <richard-llvm@metafoo.co.uk> Avoid using __SIZE_TYPE__ in a -std=c++98 -pedantic-errors test, because that
triggers an error on MS targets where __SIZE_TYPE__ expands to 'long long'.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184096 91177308-0d34-0410-b5e6-96231b3b80d8
rs/dr1xx.cpp
9109bf10d50d3b5aa57205db1b8e38a31e3ae477 17-Jun-2013 Richard Smith <richard-llvm@metafoo.co.uk> C++11: don't warn about the deprecated 'register' keyword if it's combined with
an asm label.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184069 91177308-0d34-0410-b5e6-96231b3b80d8
lass/class.friend/p6.cpp
ed7dc87192784841839908a88b6d0623f6278408 16-Jun-2013 Richard Smith <richard-llvm@metafoo.co.uk> Add tests for C++ DR100-150.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184057 91177308-0d34-0410-b5e6-96231b3b80d8
rs/dr1xx.cpp
0012dd4846953cabbf5fe00ad13d61b1f5a3cc08 16-Jun-2013 Richard Smith <richard-llvm@metafoo.co.uk> Add testcase for DR39 from PR5916.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184056 91177308-0d34-0410-b5e6-96231b3b80d8
rs/dr0xx.cpp
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/expr.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/expr.const/p2-0x.cpp
xpr/expr.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/expr.prim/expr.prim.lambda/p4.mm
6698be8a6930730df5e61c941197e72682196187 13-Jun-2013 Richard Smith <richard-llvm@metafoo.co.uk> Fix some confusing diagnostic wording. s/implicit default/implicit/ if we're
not actually talking about a default constructor.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183885 91177308-0d34-0410-b5e6-96231b3b80d8
lass.access/p4.cpp
rs/dr0xx.cpp
79f4bb7aad1b7c53f8a3bc43d89de0efdef8286d 13-Jun-2013 Richard Smith <richard-llvm@metafoo.co.uk> Add -Wdeprecated warnings and fixits for things deprecated in C++11:
- 'register' storage class
- dynamic exception specifications

Only the former check is enabled by default for now (the latter might be quite noisy).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183881 91177308-0d34-0410-b5e6-96231b3b80d8
lass/class.friend/p6.cpp
tmt.stmt/stmt.iter/stmt.ranged/p1.cpp
98a75581e155a7dac853a69b0151960f8e2aacbd 13-Jun-2013 Nick Lewycky <nicholas@mxc.ca> Include the unexpanded packs in the initializer expression when checking a
pack expanded constructor initializer list. Fixes PR16303!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183878 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.variadic/p5.cpp
7c3e615f01e8f9f587315800fdaf2305ed824568 13-Jun-2013 Richard Smith <richard-llvm@metafoo.co.uk> PR12086, PR15117

Introduce CXXStdInitializerListExpr node, representing the implicit
construction of a std::initializer_list<T> object from its underlying array.
The AST representation of such an expression goes from an InitListExpr with a
flag set, to a CXXStdInitializerListExpr containing a MaterializeTemporaryExpr
containing an InitListExpr (possibly wrapped in a CXXBindTemporaryExpr).

This more detailed representation has several advantages, the most important of
which is that the new MaterializeTemporaryExpr allows us to directly model
lifetime extension of the underlying temporary array. Using that, this patch
*drastically* simplifies the IR generation of this construct, provides IR
generation support for nested global initializer_list objects, fixes several
bugs where the destructors for the underlying array would accidentally not get
invoked, and provides constant expression evaluation support for
std::initializer_list objects.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183872 91177308-0d34-0410-b5e6-96231b3b80d8
cl.decl/dcl.init/dcl.init.list/p3-0x.cpp
a4bb99cd0055ba0e1f3107890e5b6cbe31e6d1cc 12-Jun-2013 Richard Smith <richard-llvm@metafoo.co.uk> Move detection of reference members binding to temporaries from building of
CXXCtorInitializers to the point where we perform the questionable lifetime
extension. This exposed a selection of false negatives in the warning.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183869 91177308-0d34-0410-b5e6-96231b3b80d8
pecial/class.copy/p11.0x.copy.cpp
pecial/class.copy/p11.0x.move.cpp
pecial/class.ctor/p5-0x.cpp
emp/temp.param/p5.cpp
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
rs/dr0xx.cpp
xpr/expr.unary/expr.unary.op/p4.cpp
2ec2b8459392f3f2f00d816b40e73113d444d838 11-Jun-2013 David Majnemer <david.majnemer@gmail.com> Implement DR85: Redeclaration of member is forbidden

Disallow the existence of a declaration of a member class that isn't a
forward declaration before it's definition.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183722 91177308-0d34-0410-b5e6-96231b3b80d8
rs/dr0xx.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/expr.prim/expr.prim.general/p3-0x.cpp
585bee48bac063f31696e308798f9432b5ba4116 07-Jun-2013 David Majnemer <david.majnemer@gmail.com> Implement DR7

Disallowing deriving from classes that have private virtual base classes
except in instances where the deriving class would be able to cast
itself to the private virtual base via a different derivation.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183462 91177308-0d34-0410-b5e6-96231b3b80d8
rs/dr0xx.cpp
c2fe81898b1b3b948791ca4ababd3d495601f22a 04-Jun-2013 David Blaikie <dblaikie@gmail.com> Bound member function diagnostic - suggest no-args calls and note overload candidates

Still missing cases for templates, but this is a step in the right
direction. Also omits suggestions that would be ambiguous (eg: void
func(int = 0); + void func(float = 0); func;)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183173 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p6.cpp
ver/over.over/p2-resolve-single-template-id.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/expr.const/p2-0x.cpp
b28e88c18ade461f54d0f2faefb1cacb209586e2 27-May-2013 Richard Smith <richard-llvm@metafoo.co.uk> Tests and status for DR51-99.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182720 91177308-0d34-0410-b5e6-96231b3b80d8
rs/dr0xx.cpp
1c7315116ffb9b7527358ef2d145c5db68fccb36 19-May-2013 Richard Smith <richard-llvm@metafoo.co.uk> Tests and status for core issues 1-50.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182207 91177308-0d34-0410-b5e6-96231b3b80d8
lass.derived/class.member.lookup/p7.cpp
rs/dr0xx.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/expr.prim/expr.prim.lambda/p11-1y.cpp
xpr/expr.prim/expr.prim.lambda/p23.cpp
xpr/expr.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
cl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p12-1y.cpp
xpr/expr.prim/expr.prim.lambda/p4-1y.cpp
xpr/expr.prim/expr.prim.lambda/p4.cpp
a8942d7686dde6d221a176c502ce857bdc409dab 07-May-2013 Richard Smith <richard-llvm@metafoo.co.uk> C++1y: an assignment operator is implicitly 'constexpr' if it would only call 'constexpr' assignment operators for a literal class type.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181284 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/dcl.spec/dcl.constexpr/p3.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
cl.decl/dcl.init/dcl.init.ref/p5.cpp
xpr/expr.post/expr.const.cast/p1-0x.cpp
xpr/expr.unary/expr.sizeof/p1.cpp
ce61715606b5f55ccc023720cdf9c1a796b0d526 06-May-2013 Richard Smith <richard-llvm@metafoo.co.uk> C++1y: support 'for', 'while', and 'do ... while' in constant expressions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181181 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/dcl.spec/dcl.constexpr/p3.cpp
cl.dcl/dcl.spec/dcl.constexpr/p4.cpp
5528ac9f40ec6cb54e7096908bf2beeed511bce4 06-May-2013 Richard Smith <richard-llvm@metafoo.co.uk> C++1y: support for increment and decrement in constant expression evaluation.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181173 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/dcl.spec/dcl.constexpr/p3.cpp
b476a14e9b35ef2448b42b033e1f0cceaa3f2778 05-May-2013 Richard Smith <richard-llvm@metafoo.co.uk> Factor out duplication between lvalue-to-rvalue conversions and variable
assignments in constant expressions. No significant functionality changes
(slight improvement to potential constant expression checking).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181170 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/dcl.spec/dcl.constexpr/p3.cpp
60e141e1f87211ca831de6821003d80fe20a06f3 04-May-2013 Richard Smith <richard-llvm@metafoo.co.uk> Implement most of N3638 (return type deduction for normal functions).
Missing (somewhat ironically) is support for the new deduction rules
in lambda functions, plus PCH support for return type patching.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181108 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p3-1y.cpp
cl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p6-1y.cpp
82f145d4ed86d19cb2a1680cda53fdc39bb38eb6 04-May-2013 Richard Smith <richard-llvm@metafoo.co.uk> Don't build a call expression referring to a function which we're not allowed
to use. This makes very little difference right now (other than suppressing
follow-on errors in some cases), but will matter more once we support deduced
return types (we don't want expressions with undeduced return types in the
AST).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181107 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/dcl.spec/dcl.type/dcl.type.simple/p5-cxx0x.cpp
ffd015e316fff53f23e9ffd4907b88b8706e4183 04-May-2013 Richard Smith <richard-llvm@metafoo.co.uk> Say 'decltype(auto)' not 'auto' as appropriate in mismatched-deduction diagnostic.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181103 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p6-1y.cpp
14f78f4a11df4c06667e2cbb87eeb179e4cb46fe 04-May-2013 Richard Smith <richard-llvm@metafoo.co.uk> Separate out and special-case the diagnostic for 'auto' in a
conversion-type-id, in preparation for this becoming valid in c++1y mode.
No functionality change; small diagnostic improvement.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181089 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p2.cpp
cl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p5.cpp
39b60dc786950e553f5e12fa0e692a33f650a568 02-May-2013 Douglas Gregor <dgregor@apple.com> Fix crasher when the range in a C++ range-for loop has an ill-formed initializer.

Fixes <rdar://problem/13712739>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180937 91177308-0d34-0410-b5e6-96231b3b80d8
tmt.stmt/stmt.iter/stmt.ranged/p1.cpp
a2c3646c35dd09d21b74826240aa916545b1873f 26-Apr-2013 Richard Smith <richard-llvm@metafoo.co.uk> Implement C++1y decltype(auto).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180610 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p3-1y.cpp
cl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p6-1y.cpp
65dfa2b31794ff4013cb3f9a8178305b56a3d549 25-Apr-2013 Rafael Espindola <rafael.espindola@gmail.com> Don't mark 'extern "C" void f(void)' as having extern storage class.

Instead, we check for one line extern "C" context in linkage computation and
when deciding if a variable is a definition.

This hopefully completes the transition to having "as written" semantics for
hasExternalStorage.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180258 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/dcl.link/p7-2.cpp
a10b97898ee6339c3110e6ca33f178ff52f05238 22-Apr-2013 Richard Smith <richard-llvm@metafoo.co.uk> C++1y constexpr extensions, round 1: Allow most forms of declaration and
statement in constexpr functions. Everything which doesn't require variable
mutation is also allowed as an extension in C++11. 'void' becomes a literal
type to support constexpr functions which return 'void'.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180022 91177308-0d34-0410-b5e6-96231b3b80d8
asic/basic.types/p10.cpp
cl.dcl/dcl.spec/dcl.constexpr/p3.cpp
cl.dcl/dcl.spec/dcl.constexpr/p4.cpp
xcept/except.spec/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
asic/basic.types/p10.cpp
cl.dcl/dcl.spec/dcl.constexpr/p1.cpp
cl.dcl/dcl.spec/dcl.constexpr/p3.cpp
cl.dcl/dcl.spec/dcl.constexpr/p5.cpp
cl.dcl/dcl.spec/dcl.constexpr/p6.cpp
cl.dcl/dcl.spec/dcl.constexpr/p8.cpp
cl.dcl/dcl.spec/dcl.type/dcl.type.simple/p5-cxx0x.cpp
cl.dcl/p4-0x.cpp
cl.decl/dcl.fct.def/dcl.fct.def.default/p2.cpp
xpr/expr.ass/p9-cxx11.cpp
xpr/expr.const/p2-0x.cpp
xpr/expr.const/p3-0x.cpp
xpr/expr.const/p5-0x.cpp
tmt.stmt/stmt.select/stmt.switch/p2-0x.cpp
emp/temp.decls/temp.variadic/multi-level-substitution.cpp
emp/temp.spec/temp.explicit/p1-0x.cpp
c3bf52ced9652f555aa0767bb822ec4c64546212 21-Apr-2013 Richard Smith <richard-llvm@metafoo.co.uk> C++1y: Allow aggregates to have default initializers.

Add a CXXDefaultInitExpr, analogous to CXXDefaultArgExpr, and use it both in
CXXCtorInitializers and in InitListExprs to represent a default initializer.

There's an additional complication here: because the default initializer can
refer to the initialized object via its 'this' pointer, we need to make sure
that 'this' points to the right thing within the evaluation.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179958 91177308-0d34-0410-b5e6-96231b3b80d8
cl.decl/dcl.init/dcl.init.aggr/p1-0x.cpp
cl.decl/dcl.init/dcl.init.aggr/p7.cpp
987c03085558277a5fe8cef8e1b628cabcc626dc 17-Apr-2013 Richard Smith <richard-llvm@metafoo.co.uk> PR15755: don't drop parameter packs when dropping parameters with default
arguments in the formation of a candidate set of inheriting constructors.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179708 91177308-0d34-0410-b5e6-96231b3b80d8
pecial/class.inhctor/p1.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/expr.prim/expr.prim.lambda/default-arguments.cpp
xpr/expr.prim/expr.prim.lambda/p5.cpp
b16ae8b754fa7ecf80a81e1cb598e17a39d4c167 15-Apr-2013 Richard Smith <richard-llvm@metafoo.co.uk> Add triples to these tests since they're now using TLS, which isn't available on all targets.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179514 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.arg/temp.arg.nontype/p1-11.cpp
38afbc7361d861968232defaeaf8e302af75b5ee 13-Apr-2013 Richard Smith <richard-llvm@metafoo.co.uk> Annotate flavor of TLS variable (statically or dynamically initialized) onto the AST.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179447 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.arg/temp.arg.nontype/p1-11.cpp
ec64244f5939fa81596fbeddad966cca4b4a4c51 13-Apr-2013 Richard Smith <richard-llvm@metafoo.co.uk> Parsing support for thread_local and _Thread_local. We give them the same
semantics as __thread for now.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179424 91177308-0d34-0410-b5e6-96231b3b80d8
lass/class.friend/p6.cpp
1fd1e288d0f45b86d191d8f53f569e5143f3a18a 11-Apr-2013 Jordan Rose <jordan_rose@apple.com> Force a load when creating a reference to a temporary copied from a bitfield.

For this source:
const int &ref = someStruct.bitfield;

We used to generate this AST:

DeclStmt [...]
`-VarDecl [...] ref 'const int &'
`-MaterializeTemporaryExpr [...] 'const int' lvalue
`-ImplicitCastExpr [...] 'const int' lvalue <NoOp>
`-MemberExpr [...] 'int' lvalue bitfield .bitfield [...]
`-DeclRefExpr [...] 'struct X' lvalue ParmVar [...] 'someStruct' 'struct X'

Notice the lvalue inside the MaterializeTemporaryExpr, which is very
confusing (and caused an assertion to fire in the analyzer - PR15694).

We now generate this:

DeclStmt [...]
`-VarDecl [...] ref 'const int &'
`-MaterializeTemporaryExpr [...] 'const int' lvalue
`-ImplicitCastExpr [...] 'int' <LValueToRValue>
`-MemberExpr [...] 'int' lvalue bitfield .bitfield [...]
`-DeclRefExpr [...] 'struct X' lvalue ParmVar [...] 'someStruct' 'struct X'

Which makes a lot more sense. This allows us to remove code in both
CodeGen and AST that hacked around this special case.

The commit also makes Clang accept this (legal) C++11 code:

int &&ref = std::move(someStruct).bitfield

PR15694 / <rdar://problem/13600396>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179250 91177308-0d34-0410-b5e6-96231b3b80d8
cl.decl/dcl.init/dcl.init.ref/p5-0x.cpp
0b0ca4724d1c05dc0dd1d6e5aff4c8a439cbb1a2 10-Apr-2013 Richard Smith <richard-llvm@metafoo.co.uk> Add support for computing the exception specification for an inheriting
constructor. This isn't quite perfect (as usual, we don't handle default
arguments correctly yet, and we don't deal with copy/move constructors for
arguments correctly either, but this will be fixed when we implement core issue
1351.

This completes our support for inheriting constructors.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179154 91177308-0d34-0410-b5e6-96231b3b80d8
xcept/except.spec/p14.cpp
4841ca5f83bf970f910ac7d154cdd71d2a3cf481 10-Apr-2013 Richard Smith <richard-llvm@metafoo.co.uk> C++11 inheriting constructors: support for inheriting constructor templates.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179151 91177308-0d34-0410-b5e6-96231b3b80d8
pecial/class.inhctor/elsewhere.cpp
pecial/class.inhctor/p1.cpp
pecial/class.inhctor/p2.cpp
pecial/class.inhctor/p3.cpp
pecial/class.inhctor/p4.cpp
pecial/class.inhctor/p7.cpp
pecial/class.inhctor/p8.cpp
7e0c22714e4750a2f730035957f9bb678ae681c0 10-Apr-2013 Douglas Gregor <dgregor@apple.com> <rdar://problem/13605348> Don't consider invalid user-defined literal operators during overload resolution.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179150 91177308-0d34-0410-b5e6-96231b3b80d8
ver/over.oper/over.literal/p2.cpp
34366208e3ec6876ef501e85978466d2ddecb3d2 09-Apr-2013 Douglas Gregor <dgregor@apple.com> Skip transparent contexts when looking for using directives in name lookup.

Fixes the bootstrap regression I introduced in r179067.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179079 91177308-0d34-0410-b5e6-96231b3b80d8
asic/basic.lookup/basic.lookup.unqual/p14.cpp
484f6fa0bd6b16b64e5c4cb40260f69a3dd52b4a 09-Apr-2013 Douglas Gregor <dgregor@apple.com> <rdar://problem/13584715> Converted constant expressions are expected to have integral values.

We were assuming that any expression used as a converted constant
expression would either not have a folded constant value or would be
an integer, which is not the case for some ill-formed constant
expressions. Because converted constant expressions are only used
where integral values are expected, we can simply treat this as an
error path. If that ever changes, we'll need to widen the interface of
Sema::CheckConvertedConstantExpression() anyway.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179068 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/dcl.spec/dcl.constexpr/p3.cpp
44b2ea97957b553e76e757c1926c3ad1fadbe1b2 09-Apr-2013 Douglas Gregor <dgregor@apple.com> <rdar://problem/13540899> Collect using directives from all of the semantic contexts not represented by scopes.

This fixes a regression I introduced in r178136, where we would not
consider the using directives from the semantic declaration contexts
that aren't represented by the lexical scopes (Scope) when performing
unqualified name lookup. This lead to horribly funny diagnostics like
"no identifier named 'foo'; did you mean 'foo'?".



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179067 91177308-0d34-0410-b5e6-96231b3b80d8
asic/basic.lookup/basic.lookup.unqual/p14.cpp
0ab5b4c438b40c72252933072d4c9e9a948106f0 02-Apr-2013 Richard Smith <richard-llvm@metafoo.co.uk> If a defaulted special member is implicitly deleted, check whether it's
overriding a non-deleted virtual function. The existing check for this doesn't
catch this case, because it fires before we mark the method as deleted.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178563 91177308-0d34-0410-b5e6-96231b3b80d8
lass.derived/class.abstract/p16.cpp
pecial/class.dtor/p5-0x.cpp
5b8740f840238b3616691e5b300df57a758f32a6 01-Apr-2013 John McCall <rjmccall@apple.com> Only merge down a variable type if the previous declaration was
visible. There's a lot of potential badness in how we're modelling
these things, but getting this much correct is reasonably easy.

rdar://13535367

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178488 91177308-0d34-0410-b5e6-96231b3b80d8
asic/basic.link/p6.cpp
6bed88e9d25fd7e16edf3d95447ba414d9d73d72 27-Mar-2013 Douglas Gregor <dgregor@apple.com> <rdar://problem/13317030> Consider using directives when performing unqualified name lookup into declarations contexts represented by the qualified-id but not in the actual scope hierarchy.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178136 91177308-0d34-0410-b5e6-96231b3b80d8
asic/basic.lookup/basic.lookup.unqual/p14.cpp
defa32ef4fdc166d39d2d0859e5edbd78da2ddd0 27-Mar-2013 Douglas Gregor <dgregor@apple.com> <rdar://problem/13278115> Improve diagnostic when failing to bind an rvalue reference to an lvalue of compatible type.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178095 91177308-0d34-0410-b5e6-96231b3b80d8
cl.decl/dcl.init/dcl.init.ref/p5-0x.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/expr.prim/expr.prim.general/p3-0x.cpp
f9223aad2666a9166152a2c666df581376e6906a 26-Mar-2013 Richard Smith <richard-llvm@metafoo.co.uk> Remove FIXMEs: these are covered by a core issue which we don't yet implement
(but we happen to get this part right).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177958 91177308-0d34-0410-b5e6-96231b3b80d8
asic/basic.lookup/basic.lookup.qual/class.qual/p2.cpp
2db075b1d3b16f0100fe06408dfb4ab7d50700a4 26-Mar-2013 Richard Smith <richard-llvm@metafoo.co.uk> Implement special-case name lookup for inheriting constructors: member
using-declarations with names which look constructor-like are interpreted as
constructor names.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177957 91177308-0d34-0410-b5e6-96231b3b80d8
asic/basic.lookup/basic.lookup.qual/class.qual/p2.cpp
6c5aaed0d4faf9ab8793423529306e7116e9f0fd 26-Mar-2013 Douglas Gregor <dgregor@apple.com> <rdar://problem/13395022> Strip references when extracting an initializer_list's element type during application of an initialization sequence.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177944 91177308-0d34-0410-b5e6-96231b3b80d8
cl.decl/dcl.init/dcl.init.list/p3-0x.cpp
c96cd7a07a68f74fec35297cc1f2a3d2171fdcdb 20-Mar-2013 John McCall <rjmccall@apple.com> Don't look outside the innermost enclosing namespace when
performing unqualified lookup for a friend class declaration.

rdar://13393749

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177473 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/basic.namespace/namespace.def/namespace.memdef/p3.cpp
07b0fdcee8d64222b274779d02851cc53d18e0db 18-Mar-2013 Richard Smith <richard-llvm@metafoo.co.uk> Bring inheriting constructor implementation up-to-date with current defect
reports, and implement implicit definition of inheriting constructors.
Remaining missing features: inheriting constructor templates, implicit
exception specifications for inheriting constructors, inheriting constructors
from dependent bases.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177320 91177308-0d34-0410-b5e6-96231b3b80d8
pecial/class.inhctor/elsewhere.cpp
pecial/class.inhctor/p1.cpp
pecial/class.inhctor/p2.cpp
pecial/class.inhctor/p3.cpp
pecial/class.inhctor/p4.cpp
pecial/class.inhctor/p7.cpp
pecial/class.inhctor/p8.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/expr.prim/expr.prim.general/p3-0x.cpp
3cdbbdc53241907939486ba4a9b0c9b5655419c3 06-Mar-2013 Richard Smith <richard-llvm@metafoo.co.uk> PR15390: If a function returns a pointer to a function, that function type
can't have default arguments even though it's a parameter-declaration-clause in
a function declaration.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176542 91177308-0d34-0410-b5e6-96231b3b80d8
cl.decl/dcl.meaning/dcl.fct.default/p3.cpp
4b02dff7aebb98d2d60b2ff4d3fc86109213128c 05-Mar-2013 David Blaikie <dblaikie@gmail.com> Add quotation marks to template names in diagnostics.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176474 91177308-0d34-0410-b5e6-96231b3b80d8
asic/basic.lookup/basic.lookup.unqual/p7.cpp
emp/temp.fct.spec/temp.deduct/temp.deduct.call/basic.cpp
714b509bb4f8be76e6616944551efe7a6e8358cd 27-Feb-2013 John McCall <rjmccall@apple.com> Don't crash when diagnosing path-constrained protected
access to a private member to which we have special access.

rdar://12926092

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176146 91177308-0d34-0410-b5e6-96231b3b80d8
lass.access/class.access.base/p5.cpp
4da090394caafe7be5b66ad03409c06566444926 22-Feb-2013 Richard Smith <richard-llvm@metafoo.co.uk> Don't crash if we try to apply 'alignas' to a variable declared with an
incomplete type.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175880 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/dcl.attr/dcl.align/p6.cpp
4e1125f630e75a52209b928e9d43b638abf39987 22-Feb-2013 Bill Wendling <isanbard@gmail.com> Update to use references to attribute groups instead of listing the attributes on the call/invoke instructions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175878 91177308-0d34-0410-b5e6-96231b3b80d8
xcept/except.spec/p14-ir.cpp
xcept/except.spec/p9-noexcept.cpp
671b3219c2be00ef8f26234ec993816c3ba56a4f 22-Feb-2013 Richard Smith <richard-llvm@metafoo.co.uk> Implement C++11 [dcl.align]p6-p8, and C11 6.7.5/7. This had to be split out of
the normal attribute-merging path, because we can't merge alignment attributes
without knowing the complete set of alignment attributes which apply to a
particular declaration.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175861 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/dcl.attr/dcl.align/p6.cpp
cl.dcl/dcl.attr/dcl.align/p7.cpp
cl.dcl/dcl.attr/dcl.align/p8.cpp
637619b915888ead5576d19508644e4eb9024078 22-Feb-2013 John McCall <rjmccall@apple.com> Only suppress instance context if a member is actually
accessible in its declaring class; otherwise we might
fail to apply [class.protected] when considering
accessibility in derived classes.

Noticed by inspection; <rdar://13270329>.

I had an existing test wrong. Here's why it's wrong:

Follow the rules (and notation) of [class.access]p5.
The naming class (N) is B and the context (R) is D::getX.
- 'x' as a member of B is protected, but R does not occur
in a member or friend of a class derived from B.
- There does exist a base class of B, A, which is accessible
from R, and 'x' is accessible at R when named in A because
'x' as a member of A is protected and R occurs in a member
of a class, D, that is derived from A; however, by
[class.protected], the class of the object expression must
be equal to or derived from that class, and A does not
derive from D.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175858 91177308-0d34-0410-b5e6-96231b3b80d8
lass.access/class.protected/p1.cpp
478bbf3171cc6ed10e544440b72413b3fdfbb0b6 21-Feb-2013 Bill Wendling <isanbard@gmail.com> Try to get buildbots to pass these tests.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175784 91177308-0d34-0410-b5e6-96231b3b80d8
pecial/class.dtor/p3-0x.cpp
3bba3efba0e57071d60b355ed62639f93e37711c 20-Feb-2013 Bill Wendling <isanbard@gmail.com> Attempt to clean up tests for non-X86 platforms.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175652 91177308-0d34-0410-b5e6-96231b3b80d8
pecial/class.dtor/p3-0x.cpp
2f98ad38b8e02146ecfc1760160dec676ce6d1e0 20-Feb-2013 Bill Wendling <isanbard@gmail.com> Remove target-specific features.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175610 91177308-0d34-0410-b5e6-96231b3b80d8
pecial/class.dtor/p3-0x.cpp
f7a9da053f5bd6c18450c1796d953b42c3b7ad3a 20-Feb-2013 Bill Wendling <isanbard@gmail.com> Modify the tests to use attribute group references instead of listing the
function attributes.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175606 91177308-0d34-0410-b5e6-96231b3b80d8
pecial/class.dtor/p3-0x.cpp
ddf117e1e4e53e8bcd505afda0c4e68baff086c2 12-Feb-2013 Dmitri Gribenko <gribozavr@gmail.com> Add a test for r174980, that we used to accept


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175005 91177308-0d34-0410-b5e6-96231b3b80d8
pecial/class.ctor/p1.cpp
1b9e8f7e0bf2c6a2857f1b2208ca5f83b567b835 12-Feb-2013 Dmitri Gribenko <gribozavr@gmail.com> Accept over-qualified constructor in MSVC emulation mode

MSVC accepts this:

class A {
A::A();
};

Clang accepts regular member functions with extra qualification as an MS
extension, but not constructors. This changes the parser to defer rejecting
qualified constructors so that the same Sema logic can apply to constructors as
regular member functions. This also improves the error message when MS
extensions are disabled (in my opinion). Before it was:

/Users/jason/Desktop/test.cpp:2:8: error: expected member name or ';' after declaration specifiers
A::A();
~~~~ ^
1 error generated.

After:

/Users/jason/Desktop/test.cpp:2:6: error: extra qualification on member 'A'
A::A();
~~~^
1 error generated.

Patch by Jason Haslam.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174980 91177308-0d34-0410-b5e6-96231b3b80d8
pecial/class.ctor/p1.cpp
66b22771fc0a1dba598e50469f2961048e7edd55 12-Feb-2013 John McCall <rjmccall@apple.com> Call __cxa_begin_catch with the current exception before
calling std::terminate(). rdar://11904428

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174940 91177308-0d34-0410-b5e6-96231b3b80d8
xcept/except.spec/p9-noexcept.cpp
ce6a10eaadd152f05103dfffe22ac20ef2c04615 06-Feb-2013 Nick Lewycky <nicholas@mxc.ca> Don't check whether a friend declaration is correctly formed when instantiating,
we already checked it when parsing.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174486 91177308-0d34-0410-b5e6-96231b3b80d8
lass.access/class.friend/p3-cxx0x.cpp
a4dc51b46861eb52626f89183da7610437baba93 05-Feb-2013 Richard Smith <richard-llvm@metafoo.co.uk> Add some missing diagnostics for C++11 narrowing conversions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174337 91177308-0d34-0410-b5e6-96231b3b80d8
cl.decl/dcl.init/dcl.init.list/p3-0x.cpp
be507b6e72df8ab5e7d8c31eb4453e1bdf5fcfaf 01-Feb-2013 Richard Smith <richard-llvm@metafoo.co.uk> Implement [dcl.align]p5 and C11 6.7.5/4: alignas cannot underalign.
Also support alignas(0), which C++11 and C11 require us to ignore.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174157 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/dcl.attr/dcl.align/p5.cpp
10318845f40d50b9d0ce010b0ea8d93a7b5ab029 01-Feb-2013 Douglas Gregor <dgregor@apple.com> Don't do delayed exception-specification checking on an invalid
class. Fixes <rdar://problem/13017229>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174145 91177308-0d34-0410-b5e6-96231b3b80d8
xcept/except.spec/p14.cpp
29805ca6d278b4d9563adfee67f2478f0fecdcfc 31-Jan-2013 Richard Smith <richard-llvm@metafoo.co.uk> Improve 'failed template argument deduction' diagnostic for the case where we
have a direct mismatch between some component of the template and some
component of the argument. The diagnostic now says what the mismatch was, but
doesn't yet say which part of the template doesn't match.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174039 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.fct.spec/temp.deduct/temp.deduct.call/basic.cpp
emp/temp.fct.spec/temp.deduct/temp.deduct.call/p1-0x.cpp
e28f6abf588f51a21d1db638e460f9c086c08db4 30-Jan-2013 Douglas Gregor <dgregor@apple.com> Unresolved lookups can have using declarations that refer to
unresolved using declarations. Fixes PR14768 / <rdar://problem/13030296>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173883 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/basic.namespace/namespace.udecl/p10.cpp
d9bf41893c3a59d5ea33e7b04b0e6211f7dca201 30-Jan-2013 David Blaikie <dblaikie@gmail.com> [Sema] Constrain test added in r173873 with expected-error-re

Suggested in post-commit review by Richard Smith.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173880 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/dcl.spec/dcl.constexpr/p1.cpp
1d87fbaeea4a9fbbd73b3a53641f59f1673098e5 30-Jan-2013 David Blaikie <dblaikie@gmail.com> Provide a fixit for constexpr non-static data members.

If the member has an initializer, assume it was probably intended to be static
and suggest/recover with that.

If the member doesn't have an initializer, assume it was probably intended to
be const instead of constexpr and suggest that.

(if the attempt to apply these changes fails, don't make any suggestion &
produce the same diagnostic experience as before. The only case where this can
come up that I know of is with a mutable constexpr with an initializer, since
mutable is incompatible with static (but it's already incompatible with
const anyway))

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173873 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/dcl.spec/dcl.constexpr/p1.cpp
a367e9de80eb05e78f06dc35c1e050799e735282 29-Jan-2013 David Blaikie <dblaikie@gmail.com> Move -Wstatic-float-init fixit into a note & don't recover as if constexpr

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173841 91177308-0d34-0410-b5e6-96231b3b80d8
lass/class.static/class.static.data/p3.cpp
lass/class.union/p2-0x.cpp
485b31292752252328de0a3db1d1cd39c87026c0 29-Jan-2013 Richard Smith <richard-llvm@metafoo.co.uk> PR15100: look through type sugar when determining whether we have one of the
forms of 'main' which we accept as an extension.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173758 91177308-0d34-0410-b5e6-96231b3b80d8
asic/basic.start/basic.start.main/p2.cpp
2f83694302798936fe1f7768a91063350d1b79e5 29-Jan-2013 Richard Smith <richard-llvm@metafoo.co.uk> Fold tests for C++ 'main' into a single file.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173756 91177308-0d34-0410-b5e6-96231b3b80d8
asic/basic.start/basic.start.main/p2.cpp
asic/basic.start/basic.start.main/p2a.cpp
asic/basic.start/basic.start.main/p2b.cpp
asic/basic.start/basic.start.main/p2c.cpp
asic/basic.start/basic.start.main/p2d.cpp
asic/basic.start/basic.start.main/p2e.cpp
asic/basic.start/basic.start.main/p2f.cpp
asic/basic.start/basic.start.main/p2g.cpp
asic/basic.start/basic.start.main/p2h.cpp
asic/basic.start/basic.start.main/p2i.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/expr.const/p2-0x.cpp
3a2b7a18a4504f39e3ded0d2b5749c5c80b8b9b5 28-Jan-2013 Richard Smith <richard-llvm@metafoo.co.uk> Finish semantic analysis for [[carries_dependency]] attribute.

This required plumbing through a new flag to determine whether a ParmVarDecl is
actually a parameter of a function declaration (as opposed to a function
typedef etc, where the attribute is prohibited). Weirdly, this attribute (just
like [[noreturn]]) cannot be applied to a function type, just to a function
declaration (and its parameters).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173726 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/dcl.attr/dcl.attr.depend/p1.cpp
cl.dcl/dcl.attr/dcl.attr.depend/p2.cpp
d98f708a9b17dc57c1305cd1ab15f72912db7db3 28-Jan-2013 Richard Smith <richard-llvm@metafoo.co.uk> Tests and a minor bugfix for [dcl.attr.depend]p1 (C++11 [[carries_dependency]]
attribute).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173645 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/dcl.attr/dcl.attr.depend/p1.cpp
b4b1d69f19f32e8aeb2ce1e0239c6e20a7f9e952 25-Jan-2013 Richard Smith <richard-llvm@metafoo.co.uk> Sync 'in class initialization of static const double' extension up with GCC,
and split it out of -Wgnu into its own warning flag.

* In C++11, this is now a hard error (GCC has no extension here in C++11 mode).
The error can be disabled with -Wno-static-float-init, and has a fixit to
add 'constexpr'.

* In C++98, this is still an ExtWarn, but is now controlled by
-Wstatic-float-init as well as -Wgnu.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173414 91177308-0d34-0410-b5e6-96231b3b80d8
lass/class.static/class.static.data/p3.cpp
lass/class.union/p2-0x.cpp
c7629d941557f7179eb8fa8a2e2a74d749cbaf7c 24-Jan-2013 Jordan Rose <jordan_rose@apple.com> Handle universal character names and Unicode characters outside of literals.

This is a missing piece for C99 conformance.

This patch handles UCNs by adding a '\\' case to LexTokenInternal and
LexIdentifier -- if we see a backslash, we tentatively try to read in a UCN.
If the UCN is not syntactically well-formed, we fall back to the old
treatment: a backslash followed by an identifier beginning with 'u' (or 'U').

Because the spelling of an identifier with UCNs still has the UCN in it, we
need to convert that to UTF-8 in Preprocessor::LookUpIdentifierInfo.

Of course, valid code that does *not* use UCNs will see only a very minimal
performance hit (checks after each identifier for non-ASCII characters,
checks when converting raw_identifiers to identifiers that they do not
contain UCNs, and checks when getting the spelling of an identifier that it
does not contain a UCN).

This patch also adds basic support for actual UTF-8 in the source. This is
treated almost exactly the same as UCNs except that we consider stray
Unicode characters to be mistakes and offer a fixit to remove them.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173369 91177308-0d34-0410-b5e6-96231b3b80d8
ver/over.oper/over.literal/p8.cpp
22eaced5cac3cf0522c953f593419fc6cf184aaf 18-Jan-2013 Douglas Gregor <dgregor@apple.com> Once we've collected the template arguments for a
partially-substituted parameter pack in a template, forget about the
partially-substituted parameter pack: it is now completed. Fixes
<rdar://problem/12176336>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172859 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.fct.spec/temp.arg.explicit/p3-0x.cpp
459455b9868974e2bb98032f768fe111ff376ada 17-Jan-2013 David Blaikie <dblaikie@gmail.com> Add test for PR12938, fixed by Richard Smith in r172691

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172697 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.spec/temp.expl.spec/p2-0x.cpp
dca97dd5dab315e82be6dad0d90c51b030bea531 17-Jan-2013 Richard Smith <richard-llvm@metafoo.co.uk> Test that we correctly handle reversion of line splicing etc in raw string
literals. As suggested by Sean Silva.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172694 91177308-0d34-0410-b5e6-96231b3b80d8
ex/lex.pptoken/p3-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
cl.dcl/dcl.attr/dcl.attr.noreturn/p1.cpp
xpr/expr.prim/expr.prim.lambda/p5.cpp
xpr/expr.prim/expr.prim.lambda/templates.cpp
419563768ef4929a622d7c2b066856e82901bb91 14-Jan-2013 Richard Smith <richard-llvm@metafoo.co.uk> Refactor to call ActOnFinishFullExpr on every full expression. Teach
ActOnFinishFullExpr that some of its checks only apply to discarded-value
expressions. This adds missing checks for unexpanded variadic template
parameter packs to a handful of constructs.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172485 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.variadic/p5.cpp
emp/temp.decls/temp.variadic/p5.mm
714fcc1bcb42508983f9fd3435aa1dcd06212a8c 14-Jan-2013 Richard Smith <richard-llvm@metafoo.co.uk> Fix regression in r172376. Don't try to detect missing 'constexpr' specifiers
on redeclarations, since that makes us pick wrong prior declarations under
some circumstances.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172384 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/dcl.spec/dcl.constexpr/p8.cpp
21c8fa87a3517d835072193a59a955ec7f6bf408 14-Jan-2013 Richard Smith <richard-llvm@metafoo.co.uk> PR12008: defer adding the implicit 'const' to a constexpr member function until
we know whether it is static.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172376 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/dcl.spec/dcl.constexpr/p8.cpp
emp/temp.spec/temp.explicit/p1-0x.cpp
601e6e894c2a38243588b375bed0b9a9e60060bb 11-Jan-2013 Enea Zaffanella <zaffanella@cs.unipr.it> Fixed an assertion failure triggered by invalid code.

Set invalid type of declarator after emitting error diagnostics,
so that it won't be later considered when instantiating the template.
Added test5_inst in test/SemaCXX/condition.cpp for non-regression.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172201 91177308-0d34-0410-b5e6-96231b3b80d8
cl.decl/dcl.meaning/dcl.fct/p8.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/expr.prim/expr.prim.lambda/p19.cpp
pecial/class.copy/implicit-move.cpp
pecial/class.copy/p23-cxx11.cpp
d538ed9b2a617239d5bd56357663de62f6f9224c 20-Dec-2012 Alexander Kornienko <alexfh@google.com> Implement AST dumper for Decls.
http://llvm-reviews.chandlerc.com/D52

Patch by Philip Craig!



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170634 91177308-0d34-0410-b5e6-96231b3b80d8
cl.decl/dcl.init/dcl.init.ref/p5-examples.cpp
1d28caf3b5254e60d3e3a1d2d37e5df2e5924111 11-Dec-2012 Richard Smith <richard-llvm@metafoo.co.uk> PR14558: Compute triviality of special members (etc) at the end of the class
definition, rather than at the end of the definition of the set of nested
classes. We still defer checking of the user-specified exception specification
to the end of the nesting -- we can't check that until we've parsed the
in-class initializers for non-static data members.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169805 91177308-0d34-0410-b5e6-96231b3b80d8
pecial/class.ctor/p5-0x.cpp
afee0ff915b87f92e8c07c72d31c3165aacf6fa8 09-Dec-2012 Richard Smith <richard-llvm@metafoo.co.uk> PR14550: If a system header contains a bogus constexpr function definition,
don't mark the function as invalid, since we suppress the error.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169689 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/dcl.spec/dcl.constexpr/p5.cpp
bc2a35d5ff492107dab5bdb7682f0da2f4a88861 08-Dec-2012 Richard Smith <richard-llvm@metafoo.co.uk> Finish implementing 'selected constructor' rules for triviality in C++11. In
the cases where we can't determine whether special members would be trivial
while building the class, we eagerly declare those special members. The impact
of this is bounded, since it does not trigger implicit declarations of special
members in classes which merely *use* those classes.

In order to determine whether we need to apply this rule, we also need to
eagerly declare move operations and destructors in cases where they might be
deleted. If a move operation were supposed to be deleted, it would instead
be suppressed, and we could need overload resolution to determine if we fall
back to a trivial copy operation. If a destructor were implicitly deleted,
it would cause the move constructor of any derived classes to be suppressed.

As discussed on cxx-abi-dev, C++11's selected constructor rules are also
retroactively applied as a defect resolution in C++03 mode, in order to
identify that class B has a non-trivial copy constructor (since it calls
A's constructor template, not A's copy constructor):

struct A { template<typename T> A(T &); };
struct B { mutable A a; };


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169673 91177308-0d34-0410-b5e6-96231b3b80d8
pecial/class.copy/p12-0x.cpp
pecial/class.copy/p25-0x.cpp
ac71351acdefc9de0c770c1d717e621ac9e684bf 08-Dec-2012 Richard Smith <richard-llvm@metafoo.co.uk> Properly compute triviality for explicitly-defaulted or deleted special members.
Remove pre-standard restriction on explicitly-defaulted copy constructors with
'incorrect' parameter types, and instead just make those special members
non-trivial as the standard requires.

This required making CXXRecordDecl correctly handle classes which have both a
trivial and a non-trivial special member of the same kind.

This also fixes PR13217 by reimplementing DiagnoseNontrivial in terms of the
new triviality computation technology.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169667 91177308-0d34-0410-b5e6-96231b3b80d8
asic/basic.types/p10.cpp
lass/class.union/p1.cpp
cl.decl/dcl.fct.def/dcl.fct.def.default/p1.cpp
cl.decl/dcl.meaning/dcl.fct/dcl.fct.def.default/p2.cpp
pecial/class.copy/p12-0x.cpp
pecial/class.copy/p25-0x.cpp
pecial/class.ctor/p5-0x.cpp
d5bc867f6597ee8d4eb31ea217934e436fc7c7e3 08-Dec-2012 Richard Smith <richard-llvm@metafoo.co.uk> Implement C++03 [dcl.init]p5's checking for value-initialization of references
properly, rather than faking it up by pretending that a reference member makes
the default constructor non-trivial. That leads to rejects-valids when putting
such types inside unions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169662 91177308-0d34-0410-b5e6-96231b3b80d8
lass/class.union/p1.cpp
cl.decl/dcl.init/p5.cpp
504643934a1cb2f9d0c22b4895c777d8aa4c5139 07-Dec-2012 Richard Smith <richard-llvm@metafoo.co.uk> Per [dcl.fct.def.default]p1, don't allow variadic special members to be defaulted.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169574 91177308-0d34-0410-b5e6-96231b3b80d8
cl.decl/dcl.fct.def/dcl.fct.def.default/p1.cpp
030a6644f253818b81b4d8a7fc1770c0a3d35474 06-Dec-2012 Richard Smith <richard-llvm@metafoo.co.uk> Fix http://stackoverflow.com/questions/13521163

Don't require that, during template deduction, a template specialization type
as a function parameter has at least as many template arguments as one used in
a function argument (not even if the argument has been resolved to an exact
type); the additional parameters might be provided by default template
arguments in the template. We don't need this check, since we now implement
[temp.deduct.call]p4 with an additional check after deduction.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169475 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.fct.spec/temp.deduct/temp.deduct.type/p9-0x.cpp
30cddaec99fa6c3207613efdaedbb51dd8d70c77 28-Nov-2012 Richard Smith <richard-llvm@metafoo.co.uk> Teach Lexer::getSpelling about raw string literals. Specifically, if a raw
string literal needs cleaning (because it contains line-splicing in the
encoding prefix or in the ud-suffix), do not clean the section between the
double-quotes -- that's the "raw" bit!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168776 91177308-0d34-0410-b5e6-96231b3b80d8
ex/lex.literal/lex.ext/p5.cpp
acf796b4797c5b3e9e237148fa622afdc04b3eff 28-Nov-2012 Richard Smith <richard-llvm@metafoo.co.uk> Store on the CXXRecordDecl whether the class has, or would have, a copy
constructor/assignment operator with a const-qualified parameter type. The
prior method for determining this incorrectly used overload resolution.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168775 91177308-0d34-0410-b5e6-96231b3b80d8
pecial/class.copy/p18-cxx11.cpp
b8abff66a8d30356c82314c4734c692cdd479e5e 28-Nov-2012 Richard Smith <richard-llvm@metafoo.co.uk> C++ core issue 1344, PR10618: promote "addition of default argument makes this
a special member" diagnostic from warning to error, and fix the cases where it
produced diagnostics with incorrect wording.

We don't support this as an extension, and we ban it even in C++98 mode. This
breaks too much (for instance, the ABI-specified calling convention for a type
can change if it acquires a copy constructor through the addition of a default
argument).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168769 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/dcl.spec/dcl.constexpr/p4.cpp
746619a5ace6dcbd0970e904b1ebda838064ec03 22-Nov-2012 Richard Smith <richard-llvm@metafoo.co.uk> Fix regression in r168477. Use canonical decl when looking for base class
specified as a qualified name.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168479 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.res/temp.dep/p3.cpp
f62c690c55fb920f3ba0a4f6e6e259e2ae7ce297 22-Nov-2012 Richard Smith <richard-llvm@metafoo.co.uk> Fix CXXRecordDecl::forallBases to not look through bases which are dependent
and defined within the current instantiation, but which are not part of the
current instantiation. Previously, it would look at bases which could be
specialized separately from the current template.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168477 91177308-0d34-0410-b5e6-96231b3b80d8
lass.derived/class.virtual/p3-0x.cpp
emp/temp.res/temp.dep/p3.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/expr.post/expr.call/p7-0x.cpp
044c8aa39d582ebc6bca1720c65ddd06fb27780c 13-Nov-2012 Richard Smith <richard-llvm@metafoo.co.uk> Fix some wrong-code bugs in implicitly-defined assignment operators:
- In C++11, perform overload resolution over all assignment operators, rather than just looking for copy/move assignment operators.
- Clean up after temporaries produced by operator= immediately, rather than accumulating them until the end of the function.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167798 91177308-0d34-0410-b5e6-96231b3b80d8
pecial/class.copy/p28-cxx11.cpp
3a9fefed0749f7a293379156c22a24509c24cc3e 12-Nov-2012 David Blaikie <dblaikie@gmail.com> Fix more try scoping bugs introduced by r167650.

Introduces more clear scoping flags & flag combinations which should hopefully
be more understandable.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167766 91177308-0d34-0410-b5e6-96231b3b80d8
asic/basic.scope/basic.scope.local/p2.cpp
3d512d8a75d4cb4609398ce3c2a3ba4c01a23513 10-Nov-2012 David Blaikie <dblaikie@gmail.com> Handle redeclarations of catch variables in catch blocks.

Fix to regression caused by r167650, caught by Richard Smith in code review.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167653 91177308-0d34-0410-b5e6-96231b3b80d8
asic/basic.scope/basic.scope.local/p2.cpp
c4027c82ad4a61f2da1b893ac8fe47bf11e5d50d 10-Nov-2012 David Blaikie <dblaikie@gmail.com> PR14296: function parameter name collisions in function try/catch

C++11 3.3.3/2 "A parameter name shall not be redeclared in the outermost block
of the function definition nor in the outermost block of any handler associated
with a function-try-block."

It's not totally clear to me whether the "FIXME" case is covered by this, but
Richard Smith thinks it probably should be. It's just a bit more involved to
fix that case.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167650 91177308-0d34-0410-b5e6-96231b3b80d8
asic/basic.scope/basic.scope.local/p2.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
cl.dcl/dcl.spec/dcl.type/p3-0x.cpp
xpr/expr.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/expr.prim/expr.prim.lambda/p14.cpp
03e6fda61f48a6f11fb3c9459d5ac3d5b1db2809 22-Oct-2012 Richard Smith <richard-llvm@metafoo.co.uk> PR14141 (part of DR1351): An implicitly-deduced "any" exception specification
produces an exception of 'noexcept(false)' and is thus compatible with an
explicit exception specification of 'noexcept(false)'.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166404 91177308-0d34-0410-b5e6-96231b3b80d8
xcept/except.spec/p14.cpp
aa9a8ce5d31975900c7243b1508f5111baddacbe 20-Oct-2012 Richard Smith <richard-llvm@metafoo.co.uk> DR1473: Do not require a space between operator"" and the ud-suffix in a
literal-operator-id.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166373 91177308-0d34-0410-b5e6-96231b3b80d8
ver/over.oper/over.literal/p8.cpp
444d384a969ce05ae534bf8be3174e308dc8c58b 20-Oct-2012 Richard Smith <richard-llvm@metafoo.co.uk> Rework implementation of DR1492: Apply the resolution to operator delete too,
since it also has an implicit exception specification. Downgrade the error to
an extwarn, since at least for operator delete, system headers like to declare
it as 'noexcept' whereas the implicit definition does not have an explicit
exception specification. Move the exception specification for user-declared
'operator delete' functions from the type-as-written into the type, to reflect
reality and to allow us to detect whether there was an implicit exception spec
or not.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166372 91177308-0d34-0410-b5e6-96231b3b80d8
xcept/except.spec/p15.cpp
xcept/except.spec/p4.cpp
pecial/class.dtor/p3.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
asic/basic.lookup/basic.lookup.argdep/p2-template-id.cpp
asic/basic.lookup/basic.lookup.classref/p3.cpp
asic/basic.lookup/basic.lookup.classref/p4-cxx11.cpp
asic/basic.lookup/basic.lookup.qual/namespace.qual/p3.cpp
asic/basic.lookup/basic.lookup.qual/namespace.qual/p4.cpp
asic/basic.lookup/basic.lookup.udir/p1.cpp
asic/basic.lookup/basic.lookup.unqual/p12.cpp
asic/basic.lookup/basic.lookup.unqual/p13.cpp
asic/basic.lookup/basic.lookup.unqual/p14.cpp
asic/basic.lookup/basic.lookup.unqual/p3.cpp
asic/basic.scope/basic.scope.pdecl/p9.cpp
asic/basic.start/basic.start.main/p2a.cpp
asic/basic.start/basic.start.main/p2b.cpp
asic/basic.start/basic.start.main/p2c.cpp
asic/basic.start/basic.start.main/p2g.cpp
asic/basic.stc/basic.stc.dynamic/p2-nodef.cpp
asic/basic.stc/basic.stc.dynamic/p2-noexceptions.cpp
lass.access/class.protected/p1-cxx11.cpp
lass.derived/p2.cpp
lass/class.friend/p1-ambiguous.cpp
lass/class.friend/p1-cxx11.cpp
lass/class.nest/p3.cpp
lass/p1-0x.cpp
lass/p6-0x.cpp
onv/conv.prom/p2.cpp
onv/conv.prom/p4.cpp
onv/conv.ptr/p2.cpp
onv/conv.qual/pr6089.cpp
cl.dcl/basic.namespace/namespace.def/p2.cpp
cl.dcl/basic.namespace/namespace.udecl/p10.cpp
cl.dcl/basic.namespace/namespace.udecl/p13.cpp
cl.dcl/basic.namespace/namespace.udir/p6.cpp
cl.decl/dcl.init/dcl.init.ref/basic.cpp
cl.decl/dcl.init/dcl.init.ref/p1.cpp
cl.decl/dcl.init/dcl.init.string/p1.cpp
cl.decl/dcl.meaning/dcl.fct.default/p2.cpp
cl.decl/dcl.meaning/dcl.fct/p14.cpp
cl.decl/dcl.meaning/dcl.ref/p6-0x.cpp
cl.decl/dcl.name/p1.cpp
cl.decl/p4-0x.cpp
xcept/except.spec/canonical.cpp
xcept/except.spec/p11.cpp
xpr/expr.cast/p4-0x.cpp
xpr/expr.const/p3-0x-nowarn.cpp
xpr/expr.post/expr.const.cast/p1-0x.cpp
xpr/expr.post/expr.ref/p3.cpp
xpr/expr.post/expr.static.cast/p3-0x.cpp
xpr/expr.post/expr.static.cast/p9-0x.cpp
xpr/expr.post/expr.type.conv/p1-0x.cpp
xpr/expr.prim/expr.prim.lambda/p15.cpp
xpr/expr.prim/expr.prim.lambda/p18.cpp
xpr/expr.prim/expr.prim.lambda/p20.cpp
xpr/expr.prim/expr.prim.lambda/p21.cpp
xpr/expr.unary/expr.unary.noexcept/sema.cpp
xpr/expr.unary/expr.unary.op/p3.cpp
xpr/p8.cpp
xpr/p9.cpp
ex/lex.literal/lex.ccon/p1.cpp
ex/lex.trigraph/p3.cpp
ver/over.built/p23.cpp
ver/over.built/p25.cpp
ver/over.match/over.match.best/over.ics.rank/p3-0x.cpp
ver/over.match/over.match.best/p1.cpp
ver/over.match/over.match.funcs/over.match.oper/p3.cpp
ver/over.match/over.match.funcs/p4-0x.cpp
ver/over.oper/over.literal/p7.cpp
pecial/class.conv/class.conv.ctor/p1.cpp
pecial/class.copy/p15-0x.cpp
pecial/class.copy/p8-cxx11.cpp
pecial/class.ctor/p1.cpp
pecial/class.dtor/p2.cpp
tmt.stmt/stmt.select/stmt.switch/p2-0x.cpp
emp/temp.arg/temp.arg.type/p2-cxx0x.cpp
emp/temp.decls/temp.alias/p1.cpp
emp/temp.decls/temp.class.spec/p9.cpp
emp/temp.decls/temp.class.spec/temp.class.order/p2.cpp
emp/temp.decls/temp.class.spec/temp.class.spec.mfunc/p1.cpp
emp/temp.decls/temp.class/temp.mem.func/p1-retmem.cpp
emp/temp.decls/temp.class/temp.mem.func/pr5056.cpp
emp/temp.decls/temp.fct/temp.func.order/p3-0x.cpp
emp/temp.decls/temp.fct/temp.func.order/p3.cpp
emp/temp.decls/temp.fct/temp.func.order/p5.cpp
emp/temp.decls/temp.fct/temp.over.link/p4.cpp
emp/temp.decls/temp.friend/p5.cpp
emp/temp.decls/temp.mem/p1.cpp
emp/temp.decls/temp.variadic/deduction.cpp
emp/temp.decls/temp.variadic/example-bind.cpp
emp/temp.decls/temp.variadic/example-function.cpp
emp/temp.decls/temp.variadic/example-tuple.cpp
emp/temp.decls/temp.variadic/injected-class-name.cpp
emp/temp.decls/temp.variadic/partial-ordering.cpp
emp/temp.fct.spec/temp.arg.explicit/p3-0x.cpp
emp/temp.fct.spec/temp.arg.explicit/p9-0x.cpp
emp/temp.fct.spec/temp.deduct/cwg1170.cpp
emp/temp.fct.spec/temp.deduct/sfinae-1.cpp
emp/temp.fct.spec/temp.deduct/temp.deduct.call/p2.cpp
emp/temp.fct.spec/temp.deduct/temp.deduct.call/p4.cpp
emp/temp.fct.spec/temp.deduct/temp.deduct.conv/p2.cpp
emp/temp.fct.spec/temp.deduct/temp.deduct.conv/p3.cpp
emp/temp.fct.spec/temp.deduct/temp.deduct.partial/p12.cpp
emp/temp.fct.spec/temp.deduct/temp.deduct.partial/p9-0x.cpp
emp/temp.fct.spec/temp.deduct/temp.deduct.type/p10-0x.cpp
emp/temp.fct.spec/temp.deduct/temp.deduct.type/p2-0x.cpp
emp/temp.fct.spec/temp.deduct/temp.deduct.type/p21.cpp
emp/temp.fct.spec/temp.deduct/temp.deduct.type/p22.cpp
emp/temp.fct.spec/temp.deduct/temp.deduct.type/p5-0x.cpp
emp/temp.fct.spec/temp.deduct/temp.deduct.type/p8-0x.cpp
emp/temp.names/p2.cpp
emp/temp.names/p4.cpp
emp/temp.param/p10-0x.cpp
emp/temp.param/p10.cpp
emp/temp.param/p13.cpp
emp/temp.param/p2.cpp
emp/temp.param/p5.cpp
emp/temp.param/p8.cpp
emp/temp.res/temp.dep/p3.cpp
emp/temp.res/temp.dep/temp.dep.constexpr/p2-0x.cpp
emp/temp.res/temp.local/p1.cpp
emp/temp.res/temp.local/p7.cpp
emp/temp.res/temp.local/p8.cpp
emp/temp.spec/temp.expl.spec/p1.cpp
emp/temp.spec/temp.expl.spec/p11.cpp
emp/temp.spec/temp.expl.spec/p9.cpp
emp/temp.spec/temp.explicit/p11.cpp
emp/temp.spec/temp.explicit/p3-0x.cpp
emp/temp.spec/temp.explicit/p6.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
cl.decl/dcl.meaning/dcl.fct.default/p3.cpp
xpr/expr.prim/expr.prim.general/p3-0x.cpp
b1502bcd67fb593a95cbf73ec3814f4015666da0 18-Oct-2012 Richard Smith <richard-llvm@metafoo.co.uk> DR1442: In a range-based for statement, namespace 'std' is not an associated
namespace.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166194 91177308-0d34-0410-b5e6-96231b3b80d8
tmt.stmt/stmt.iter/stmt.ranged/p1.cpp
6678a05ba19c40d60ed68b37262942eb887be217 18-Oct-2012 Richard Smith <richard-llvm@metafoo.co.uk> Tests for DR1507.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166162 91177308-0d34-0410-b5e6-96231b3b80d8
cl.decl/dcl.init/p7.cpp
5708c18904304ed4e39abed8131fcad5e2fc0896 17-Oct-2012 David Blaikie <dblaikie@gmail.com> Implement C++ 10.3p16 - overrides involving deleted functions must match.

Only deleted functions may override deleted functions and non-deleted functions
may only override non-deleted functions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166082 91177308-0d34-0410-b5e6-96231b3b80d8
lass.derived/class.abstract/p16.cpp
16de3db5bb059c5274e75a788581b8123c05762a 17-Oct-2012 Eli Friedman <eli.friedman@gmail.com> Move test to a more appropriate place.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166078 91177308-0d34-0410-b5e6-96231b3b80d8
st-print.cpp
915c07db05375d563187f8b75fa4f766a5220b75 17-Oct-2012 Eli Friedman <eli.friedman@gmail.com> Fix pretty-printing for variables declared in a condition. Patch by Grzegorz Jablonski.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166073 91177308-0d34-0410-b5e6-96231b3b80d8
st-print.cpp
708f69bcc1be715efd1e9f46266a9c1ead184be6 17-Oct-2012 Richard Smith <richard-llvm@metafoo.co.uk> DR1492: In a definition of a destructor, the exception specification must be
explicitly specified iff it was specified in the declaration.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166071 91177308-0d34-0410-b5e6-96231b3b80d8
pecial/class.dtor/p3-0x.cpp
pecial/class.dtor/p3.cpp
9b29f4fe3d0600edf6ba00d48f2d4f2b1984f247 16-Oct-2012 David Blaikie <dblaikie@gmail.com> Implement GCC's -Wint-to-pointer-cast.

This implementation doesn't warn on anything that GCC doesn't warn on with the
exception of templates specializations (GCC doesn't warn, Clang does). The
specific skipped cases (boolean, constant expressions, enums) are open for
debate/adjustment if anyone wants to demonstrate that GCC is being overly
conservative here. The only really obvious false positive I found was in the
Clang regression suite's MPI test - apparently MPI uses specific flag values in
pointer constants. (eg: #define FOO (void*)~0)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166039 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/dcl.spec/dcl.constexpr/p5.cpp
a143a9dcebea2ade67a2e9de1a939fbb70964015 13-Oct-2012 Eli Friedman <eli.friedman@gmail.com> Fix -ast-print for uses of operator->.

Patch by Grzegorz Jablonski.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165832 91177308-0d34-0410-b5e6-96231b3b80d8
st-print.cpp
3ea19c8307932655092235b57f04a5e6658bbc46 11-Oct-2012 David Blaikie <dblaikie@gmail.com> Fix a crash-on-invalid when parsing a reference to an invalid auto declaration

auto x((unknown));
int& y = x;

would crash because we were not flagging 'x' as an invalid declaration here.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165675 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p3.cpp
d1a55a6631b11b6c5364772023451c547eafedee 05-Oct-2012 Richard Smith <richard-llvm@metafoo.co.uk> Egriegious hack to support libstdc++4.6's broken <atomic> header, which defines
a non-inline namespace, then reopens it as inline to try to add its symbols to
the surrounding namespace. In this one special case, permit the namespace to be
reopened as inline, and patch up the name lookup tables to match.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165263 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/basic.namespace/namespace.def/p7.cpp
6880f492365cc4fa4c941aa83688635003ee7498 03-Oct-2012 Michael Han <Michael.Han@autodesk.com> Improve C++11 attribute parsing.

- General C++11 attributes were previously parsed and ignored. Now they are parsed and stored in AST.
- Add support to parse arguments of attributes that in 'gnu' namespace.
- Differentiate unknown attributes and known attributes that can't be applied to statements when emitting diagnostic.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165082 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/dcl.attr/dcl.attr.grammar/p6.cpp
72ab27732ea7a42d756a1e79727f86fbe391b42b 28-Sep-2012 Richard Smith <richard-llvm@metafoo.co.uk> When processing an InitListExpr and skipping the initialization of an invalid
record, skip at least one element from the InitListExpr to avoid an infinite
loop if we're initializing an array of unknown bound.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164851 91177308-0d34-0410-b5e6-96231b3b80d8
cl.decl/dcl.init/dcl.init.aggr/p4.cpp
073819806ba2441e2a3e550107f1e756a6ee3ad0 26-Sep-2012 Richard Smith <richard-llvm@metafoo.co.uk> Teach Type::getAs<TemplateSpecializationType> that a TemplateSpecializationType
for a type alias template can appear as sugar at any level of desugaring, just
like a TypedefType.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164655 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.param/p15-cxx0x.cpp
b6b5b97c517cc651285f620a70b1ca52fa808c5a 21-Sep-2012 David Blaikie <dblaikie@gmail.com> PR13890: Warn on abstract final classes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164359 91177308-0d34-0410-b5e6-96231b3b80d8
lass/p2-0x.cpp
d4a282be92ee55a0b392e45ce4582231af271d27 20-Sep-2012 David Blaikie <dblaikie@gmail.com> Make the wchar_t promotion test consistent across different hosts by specifying a target triple.

This test behavior differs depending (at least) on whether
sizeof(wchar_t) == sizeof(int) or not.

When they are equal, the first redeclaration will fail because decltype(+L'x')
is unsigned int instead of the expected int. This occurs on ARM.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164315 91177308-0d34-0410-b5e6-96231b3b80d8
onv/conv.prom/p2.cpp
d6f80daa84164ceeb8900da07f43b6a150edf713 20-Sep-2012 Richard Smith <richard-llvm@metafoo.co.uk> Per C++11 [class.friend]p3, the 'friend' keyword must appear first in a
non-function friend declaration. Patch by Josh Magee!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164273 91177308-0d34-0410-b5e6-96231b3b80d8
lass.access/class.friend/p3-cxx0x.cpp
407c8470d50be8edaae7ed39a3139adf35af2921 20-Sep-2012 Eli Friedman <eli.friedman@gmail.com> Fix a small FIXME involving template partial ordering and
member function templates with an rvalue ref qualifier.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164267 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.fct/temp.func.order/p3-0x.cpp
9cef0064da0fe93cf60cc351d28ddf2e95fba0b3 20-Sep-2012 Eli Friedman <eli.friedman@gmail.com> Fix function template partial ordering rules for static vs. non-static
functions.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164263 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.fct/temp.func.order/p3-0x.cpp
emp/temp.decls/temp.fct/temp.func.order/p3.cpp
97c6739a1e74a3131261081054ff4a75e4e3b64c 18-Sep-2012 Eli Friedman <eli.friedman@gmail.com> Fix a small bug in the way we handle builtin candidates for
relational operators of enumeration type. From the gcc testsuite.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164171 91177308-0d34-0410-b5e6-96231b3b80d8
ver/over.built/p1.cpp
ver/over.match/over.match.funcs/over.match.oper/p3.cpp
7fcd13658e00e4d9e66cc86899e2c2973ee510fa 14-Sep-2012 Richard Smith <richard-llvm@metafoo.co.uk> Fix incorrect comment.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163850 91177308-0d34-0410-b5e6-96231b3b80d8
onv/conv.prom/p4.cpp
b5ea91c8c4e64a937ba1f8239faa4ec017d49058 14-Sep-2012 Richard Smith <richard-llvm@metafoo.co.uk> Fix up after r163846. Sorry!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163849 91177308-0d34-0410-b5e6-96231b3b80d8
onv/conv.prom/p4.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/expr.const/p3-0x.cpp
e7ff9191f39fa5a0f48168f51f55f1f7556d5993 13-Sep-2012 Richard Smith <richard-llvm@metafoo.co.uk> Implement C++11 [conv.prom]p4: an enumeration with a fixed underlying type has
integral promotions to both its underlying type and to its underlying type's
promoted type. This matters now that boolean conversions aren't permitted in
converted constant expressions (a la DR1407): an enumerator with a fixed
underlying type of bool still can be.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163841 91177308-0d34-0410-b5e6-96231b3b80d8
onv/conv.prom/p4.cpp
75379455fc88ca1f021e55ffe1cab3a9c2b2a37a 13-Sep-2012 Douglas Gregor <dgregor@apple.com> Promote the warning about extra qualification on a declaration from a
warning to an error. C++ bans it, and both GCC and EDG diagnose it as
an error. Microsoft allows it, so we still warn in Microsoft
mode. Fixes <rdar://problem/11135644>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163831 91177308-0d34-0410-b5e6-96231b3b80d8
cl.decl/dcl.meaning/p1.cpp
emp/p3.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/expr.const/p3-0x.cpp
9a4db032ecd991626d236a502e770126db32bd31 12-Sep-2012 Richard Smith <richard-llvm@metafoo.co.uk> PR13811: Add a FunctionParmPackExpr node to handle references to function
parameter packs where the reference is not being expanded but the pack has
been. Previously, Clang would segfault in such cases.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163672 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.variadic/multi-level-substitution.cpp
6964b3f80ce1ba489e7e25e7cd58062699af9b0c 07-Sep-2012 Richard Smith <richard-llvm@metafoo.co.uk> PR9023: A template template parameter whose template parameter list contains an
unexpanded parameter pack is a pack expansion. Thus, as with a non-type template
parameter which is a pack expansion, it needs to be expanded early into a fixed
list of template parameters.

Since the expanded list of template parameters is not itself a parameter pack,
it is permitted to appear before the end of the template parameter list, so also
remove that restriction (for both template template parameter pack expansions and
non-type template parameter pack expansions).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163369 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.param/p15-cxx0x.cpp
8123b6e7838216a53ba050f07e36fee28e1bbdaf 06-Sep-2012 Sam Panzer <espanz@gmail.com> Clarified diagnostics for range-based for loops with invalid ranges

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163350 91177308-0d34-0410-b5e6-96231b3b80d8
tmt.stmt/stmt.iter/stmt.ranged/p1.cpp
8bddeb57d134c0e5f14e319271aa9015886a8ac7 25-Aug-2012 John McCall <rjmccall@apple.com> When computing the effective context for access control,
make sure we walk up the DC chain for the current context,
rather than allowing ourselves to get switched over to the
canonical DC chain. Fixes PR13642.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162616 91177308-0d34-0410-b5e6-96231b3b80d8
lass.access/class.friend/p1.cpp
lass.access/class.protected/p1.cpp
42f48fbdf31a7e8c516ba5eed486ff53966459fc 24-Aug-2012 John McCall <rjmccall@apple.com> Instantiate class template specializations during ADL.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162586 91177308-0d34-0410-b5e6-96231b3b80d8
asic/basic.lookup/basic.lookup.argdep/p2.cpp
40b2e19cae6ab85407856c70f76278f9efbeeb7c 23-Aug-2012 Richard Smith <richard-llvm@metafoo.co.uk> When disambiguating an expression-statement from a declaraton-statement, if the
statement starts with an identifier for which name lookup will fail either way,
look at later tokens to disambiguate in order to improve error recovery.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162464 91177308-0d34-0410-b5e6-96231b3b80d8
lass.access/class.friend/p1.cpp
e1715b66a878bcab315513351e5df68bfc010d2e 21-Aug-2012 Sam Panzer <espanz@gmail.com> Better diagnostics for range-based for loops with bad range types.

The old error message stating that 'begin' was an undeclared identifier
is replaced with a new message explaining that the error is in the range
expression, along with which of the begin() and end() functions was
problematic if relevant.

Additionally, if the range was a pointer type or defines operator*,
attempt to dereference the range, and offer a FixIt if the modified range
works.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162248 91177308-0d34-0410-b5e6-96231b3b80d8
tmt.stmt/stmt.iter/stmt.ranged/p1.cpp
1f2e1a96bec2ba6418ae7f2d2b525a3575203b6a 10-Aug-2012 John McCall <rjmccall@apple.com> Check access to friend declarations. There's a number of different
things going on here that were problematic:
- We were missing the actual access check, or rather, it was suppressed
on account of being a redeclaration lookup.
- The access check would naturally happen during delay, which isn't
appropriate in this case.
- We weren't actually emitting dependent diagnostics associated with
class templates, which was unfortunate.
- Access was being propagated incorrectly for friend method declarations
that couldn't be matched at parse-time.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161652 91177308-0d34-0410-b5e6-96231b3b80d8
lass.access/class.friend/p1.cpp
lass.access/class.friend/p9-cxx0x.cpp
emp/temp.decls/temp.friend/p1.cpp
a4b39658673954fb9f75673594b50028685fc665 06-Aug-2012 Richard Smith <richard-llvm@metafoo.co.uk> PR13499: Don't try to check whether 'override' has been validly applied until
we know whether the function is virtual. But check it as soon as we do know;
in some cases we don't need to wait for an instantiation.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161316 91177308-0d34-0410-b5e6-96231b3b80d8
lass.derived/class.virtual/p3-0x.cpp
5121781d756e7814168b4255a57545d5ca497ec3 01-Aug-2012 Aaron Ballman <aaron@aaronballman.com> Explicitly defaulted constructors cannot be used for default initialization.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161088 91177308-0d34-0410-b5e6-96231b3b80d8
cl.decl/dcl.fct.def/dcl.fct.def.default/p2.cpp
aa1e1928703f6a44d25182cd8f1978acd1dcb7ed 30-Jul-2012 Benjamin Kramer <benny.kra@googlemail.com> Update source location in test.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160964 91177308-0d34-0410-b5e6-96231b3b80d8
lass/class.union/p1.cpp
b9d0b76e42fd2d4cdfd135220302458d03ad09fe 27-Jul-2012 Richard Smith <richard-llvm@metafoo.co.uk> Final piece of core issue 1330: delay computing the exception specification of
a defaulted special member function until the exception specification is needed
(using the same criteria used for the delayed instantiation of exception
specifications for function temploids).

EST_Delayed is now EST_Unevaluated (using 1330's terminology), and, like
EST_Uninstantiated, carries a pointer to the FunctionDecl which will be used to
resolve the exception specification.

This is enabled for all C++ modes: it's a little faster in the case where the
exception specification isn't used, allows our C++11-in-C++98 extensions to
work, and is still correct for C++98, since in that mode the computation of the
exception specification can't fail.

The diagnostics here aren't great (in particular, we should include implicit
evaluation of exception specifications for defaulted special members in the
template instantiation backtraces), but they're not much worse than before.

Our approach to the problem of cycles between in-class initializers and the
exception specification for a defaulted default constructor is modified a
little by this change -- we now reject any odr-use of a defaulted default
constructor if that constructor uses an in-class initializer and the use is in
an in-class initialzer which is declared lexically earlier. This is a closer
approximation to the current draft solution in core issue 1351, but isn't an
exact match (but the current draft wording isn't reasonable, so that's to be
expected).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160847 91177308-0d34-0410-b5e6-96231b3b80d8
cl.decl/dcl.meaning/dcl.fct/dcl.fct.def.default/p1.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/expr.prim/expr.prim.lambda/blocks.mm
xpr/expr.prim/expr.prim.lambda/p23.cpp
517bb844016064f303416f09f1aeb123e32c0f66 18-Jul-2012 Richard Smith <richard-llvm@metafoo.co.uk> PR13381, part 2: when determining if a defaulted special member function should
be defined as deleted, take cv-qualifiers on class members into account when
looking up the copy or move constructor or assignment operator which will be
used for them.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160418 91177308-0d34-0410-b5e6-96231b3b80d8
pecial/class.copy/p11.0x.copy.cpp
pecial/class.copy/p23-cxx11.cpp
6a06e5ff3b680dcf7234d200309fd2400c478095 18-Jul-2012 Richard Smith <richard-llvm@metafoo.co.uk> PR13381: consider cv-qualifiers on a class member's type when determining which
constructor will be used for moving that object, in the computation of its
exception specification.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160417 91177308-0d34-0410-b5e6-96231b3b80d8
xcept/except.spec/p14.cpp
500d729e85028944355a119f9823ac99fa5ddcab 18-Jul-2012 Richard Smith <richard-llvm@metafoo.co.uk> PR13386: When matching up parameters between a function template declaration
and a function template instantiation, if there's a parameter pack in the
declaration and one at the same place in the instantiation, don't assume that
the pack wasn't expanded -- it may have expanded to nothing. Instead, go ahead
and check whether the parameter pack was expandable. We can do this as a
side-effect of the work we'd need to do anyway, to find how many parameters
were produced.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160416 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.variadic/multi-level-substitution.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/expr.const/p2-0x.cpp
8ad6c8696a23f410398fc126929b107404c59a95 08-Jul-2012 Richard Smith <richard-llvm@metafoo.co.uk> PR13293: Defer deduction of an auto type with a dependent declarator, such as "auto (*f)(T t)".


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159908 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p3.cpp
20599392a99956eaac4cf351a0935574090cb6c3 07-Jul-2012 Richard Smith <richard-llvm@metafoo.co.uk> PR12670: Support for initializing an array of non-aggregate class type from an
initializer list. Patch by Olivier Goffart, with extra testcases by Meador Inge
and Daniel Lunow.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159896 91177308-0d34-0410-b5e6-96231b3b80d8
cl.decl/dcl.init/dcl.init.list/p3-0x.cpp
16d0078d2a4b1024cbeca8e1ebe7c0ed45554f11 29-Jun-2012 Axel Naumann <Axel.Naumann@cern.ch> From Philippe Canal:
Update the two function overloads
void TemplateSpecializationType::PrintTemplateArgumentList(raw_ostream &OS,....
to behave like
std::string TemplateSpecializationType::PrintTemplateArgumentList(const TemplateArgument *Args,...
hence making sure that clang consistently adds a space between two '>' at the end of nested template arguments.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159412 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.arg/temp.arg.template/p3-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/expr.prim/expr.prim.lambda/blocks-irgen.mm
d9cf8268dcd3f4d393b7a38fef7eb40c7e7f4d10 25-Jun-2012 David Blaikie <dblaikie@gmail.com> PR12937: Explicitly deleting an explicit template specialization.

This works around a quirk in the way that explicit template specializations are
handled in Clang. We generate an implicit declaration from the original
template which the explicit specialization is considered to redeclare. This
trips up the explicit delete logic.

This change only works around that strange representation. At some point it'd
be nice to remove those extra declarations to make the AST more accurately
reflect the C++ semantics.

Review by Doug Gregor.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159167 91177308-0d34-0410-b5e6-96231b3b80d8
cl.decl/dcl.fct.def/dcl.fct.def.delete/p4.cpp
5d7700ed7645698f3e5bea8f983e61a1ec2f423b 19-Jun-2012 Richard Smith <richard-llvm@metafoo.co.uk> Fix -Wc++11-narrowing warnings for narrowing negative values to larger unsigned
types to actually includes the value, rather than saying <uninitialized>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158745 91177308-0d34-0410-b5e6-96231b3b80d8
cl.decl/dcl.init/dcl.init.list/p7-0x.cpp
0d3317e0a2e0adb57ce8d075ebdcb41a3f939805 19-Jun-2012 Kaelyn Uhrain <rikka@google.com> Improve the error message when a function overload candidate is rejected
because it expects a reference and receives a non-l-value.

For example, given:

int foo(int &);
template<int x> void b() { foo(x); }

clang will now print "expects an l-value for 1st argument" instead of
"no known conversion from 'int' to 'int &' for 1st argument". The change
in wording (and associated code to detect the case) was prompted by
comment #5 in PR3104, and should be the last bit of work needed for the
bug.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158691 91177308-0d34-0410-b5e6-96231b3b80d8
cl.decl/dcl.init/dcl.init.ref/p5-cxx03-extra-copy.cpp
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/expr.prim/expr.prim.lambda/blocks.mm
cd65f4903dc737d92655a0cf72755c16831ae668 13-Jun-2012 Richard Smith <richard-llvm@metafoo.co.uk> Add missing narrowing check: converting from a signed integral type to a wider
unsigned type is narrowing if the source is non-constant or negative.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158377 91177308-0d34-0410-b5e6-96231b3b80d8
cl.decl/dcl.init/dcl.init.list/p7-0x.cpp
54655be65585ed6618fdd7a19fa6c70efc321d3a 12-Jun-2012 Richard Smith <richard-llvm@metafoo.co.uk> If parsing a trailing-return-type fails, don't pretend we didn't have one at
all. Suppresses follow-on errors mentioned in PR13074.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158348 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p5.cpp
cl.decl/dcl.meaning/dcl.fct/p9-0x.cpp
7756afa6273cf708b5e3fbd6a6478eb2cada27e2 10-Jun-2012 Richard Smith <richard-llvm@metafoo.co.uk> Fix PR13052 properly, by performing special member lookup to determine whether
an explicitly-defaulted default constructor would be constexpr. This is
necessary in weird (but well-formed) cases where a class has more than one copy
or move constructor.

Cleanup of now-unused parts of CXXRecordDecl to follow.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158289 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/dcl.spec/dcl.constexpr/p4.cpp
3f5f558a4ca08fe952cbbdf69b87487163c9a719 08-Jun-2012 Richard Smith <richard-llvm@metafoo.co.uk> PR13051: If a constructor is explicitly defaulted, it isn't marked as being
constexpr until we get to the end of the class definition. When that happens,
be sure to remember that the class actually does have a constexpr constructor.

This is a stopgap solution, which still doesn't cover the case of a class with
multiple copy constructors (only some of which are constexpr). We should be
performing constructor lookup when implicitly defining a constructor in order
to determine whether all constructors it invokes are constexpr.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158228 91177308-0d34-0410-b5e6-96231b3b80d8
pecial/class.copy/p13-0x.cpp
pecial/class.copy/p8-cxx11.cpp
c86c40b912e53fb11ff8f745ed616035b8b7259c 06-Jun-2012 Douglas Gregor <dgregor@apple.com> Whenever we have a BalancedDelimiterTracker, we have a 'nested' scope
where '>' is going to behave as an operator (and not as a '>' closing
a template argument list).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158111 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.names/p3-0x.cpp
8d3607bf22a6a70acce3722a758f02d4ea84fc3a 06-Jun-2012 Kaelyn Uhrain <rikka@google.com> Allow CorrectTypo to add/modify nested name qualifiers to typos that
are otherwise too short to try to correct.

The TODOs added to two of the tests are for existing deficiencies in the
typo correction code that could be exposed by using longer identifiers.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158109 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.spec/temp.expl.spec/p3.cpp
113c4448003ff6fd76eaabde08d3ebfffd8a327a 06-Jun-2012 Douglas Gregor <dgregor@apple.com> A non-explicit constructor template with a second parameter that is a
parameter pack is a converting constructor. Fixes PR13003.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158040 91177308-0d34-0410-b5e6-96231b3b80d8
pecial/class.conv/class.conv.ctor/p1.cpp
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/expr.prim/expr.prim.lambda/p4.cpp
4872e1014844632083690cc1d021b95218a5023b 28-May-2012 David Blaikie <dblaikie@gmail.com> Fix PR12960 by not attempting to correct cases when we're not actually instantiatiating a template.

This comes up in the begin/end calls of a range-for (see the included test
case). Other suggestions are welcome, though this seems to do the trick without
regressing anything.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@157553 91177308-0d34-0410-b5e6-96231b3b80d8
tmt.stmt/stmt.iter/stmt.ranged/p1.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
xpr/p10-0x.cpp
25582fc0aeac053cdc115ee95cbed53f28bf592e 17-May-2012 Richard Smith <richard-llvm@metafoo.co.uk> Recover better from a missing 'typename' in a function template definition.
Disambiguate past such a potential problem, and use the absence of 'typename'
to break ties in favor of a parenthesized thingy being an initializer, if
nothing else in the declaration disambiguates it as declaring a function.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156963 91177308-0d34-0410-b5e6-96231b3b80d8
xcept/except.spec/p5-pointers.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/expr.prim/expr.prim.lambda/blocks-irgen.mm
xpr/expr.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/expr.prim/expr.prim.lambda/blocks.mm
827adaff666e53ae2f2db994bcd62ebe1ff5b9ce 15-May-2012 Richard Smith <richard-llvm@metafoo.co.uk> Don't use the implicit int rule for error recovery in C++. Instead, try to
disambiguate whether the type name was forgotten or mistyped.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156854 91177308-0d34-0410-b5e6-96231b3b80d8
lass/class.mem/p14.cpp
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/expr.unary/expr.unary.op/p6.cpp
emp/temp.spec/p5.cpp
455e3e18b8ec4a7ba3a412b9b6be99b19b7c6970 15-May-2012 Richard Smith <richard-llvm@metafoo.co.uk> Test file I forgot to 'svn add' in r156802.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156805 91177308-0d34-0410-b5e6-96231b3b80d8
cl.decl/dcl.meaning/dcl.fct/dcl.fct.def.default/p1.cpp
3003e1d6626d07e8fc4af95fad95b3a5d4c4af98 15-May-2012 Richard Smith <richard-llvm@metafoo.co.uk> Fold the six functions checking explicitly-defaulted special member functions
into one. These were all performing almost identical checks, with different bugs
in each of them.

This fixes PR12806 (we weren't setting the exception specification for an
explicitly-defaulted, non-user-provided default constructor) and enforces
8.4.2/2's rule that an in-class defaulted member must exactly match the implicit
parameter type.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156802 91177308-0d34-0410-b5e6-96231b3b80d8
lass/p6-0x.cpp
cl.decl/dcl.fct.def/dcl.fct.def.default/p2.cpp
cl.decl/dcl.init/dcl.init.aggr/p1-0x.cpp
cl.decl/dcl.meaning/dcl.fct/dcl.fct.def.default/p2.cpp
2f68ca09ca8b5944fcab14578a161511afde406f 12-May-2012 Richard Smith <richard-llvm@metafoo.co.uk> When diagnosing inaccessible temporary destructors in decltype expressions, use
the correct type and the correct source location in the diagnostic. Spotted by
Johannes Schaub!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156654 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/dcl.spec/dcl.type/dcl.type.simple/p5-cxx0x.cpp
060ddb0173ba91cd400f073ed0bd1f9b9c3a4d50 09-May-2012 Nuno Lopes <nunoplopes@sapo.pt> hopefully fix a bunch of ARM buildbot failures

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156513 91177308-0d34-0410-b5e6-96231b3b80d8
pecial/class.copy/p15-inclass.cpp
emp/temp.spec/temp.expl.spec/p14.cpp
emp/temp.spec/temp.explicit/p9-linkage.cpp
a971d2410fabb093954c4119d2287ac24208ea8d 09-May-2012 Richard Smith <richard-llvm@metafoo.co.uk> Push the knowledge that we are parsing a type-id/type-name further into the
parser, and use it to emit better diagnostics in cases where an identifer
can't be looked up as a type name.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156508 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/dcl.spec/dcl.typedef/p2-0x.cpp
cl.decl/dcl.meaning/dcl.fct/p9-0x.cpp
13489673b84fafaaf49cf5ae4e3bb9a945524dcb 07-May-2012 John McCall <rjmccall@apple.com> Change how we suppress access control in explicit instantiations
so that we actually accumulate all the delayed diagnostics. Do
this so that we can restore those diagnostics to good standing
if it turns out that we were wrong to suppress, e.g. if the
tag specifier is actually an elaborated type specifier and not
a declaration.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156291 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.spec/temp.explicit/p12.cpp
d079abfb5eefaf7da232e39a6564f561402cf4fe 07-May-2012 Richard Smith <richard-llvm@metafoo.co.uk> A union can have a constexpr defaulted default constructor, if it has an
in-class initializer for one of its fields. Value-initialization of such
a type should use the in-class initializer!

The former was just a bug, the latter is a (reported) standard defect.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156274 91177308-0d34-0410-b5e6-96231b3b80d8
pecial/class.ctor/p6-0x.cpp
7ad5c996e9519ed4e9afd1f0166be1cd2be8415a 05-May-2012 Argyrios Kyrtzidis <akyrtzi@gmail.com> Use raw_ostream in TypePrinter and eliminate uses of temporary std::strings.

Part of rdar://10796159

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156228 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.arg/temp.arg.template/p3-0x.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
lass/class.mem/p2.cpp
xpr/expr.prim/expr.prim.general/p3-0x.cpp
294fe20bfae74de9203bb9809bf12d4ae711b3db 01-May-2012 Douglas Gregor <dgregor@apple.com> We don't need a lengthy quote from the wrong standard.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155942 91177308-0d34-0410-b5e6-96231b3b80d8
asic/basic.lookup/basic.lookup.classref/p1-cxx11.cpp
587e812b6ee73a5762c3c05e7cb7a002c795ee64 01-May-2012 Douglas Gregor <dgregor@apple.com> Add test cases for r155935.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155940 91177308-0d34-0410-b5e6-96231b3b80d8
asic/basic.lookup/basic.lookup.classref/p1-cxx11.cpp
asic/basic.lookup/basic.lookup.classref/p4-cxx11.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/expr.post/expr.reinterpret.cast/p1-0x.cpp
e531001b7e44bee5c4ec0be93efbc75adb37a0e3 29-Apr-2012 Richard Smith <richard-llvm@metafoo.co.uk> PR12688: ParseCXXClassMemberDeclaration's sometimes-null ThisDecl takes another
victim. Don't crash if we have a delay-parsed exception specification for a
class member which is invalid in a way which precludes building a FunctionDecl.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155788 91177308-0d34-0410-b5e6-96231b3b80d8
lass/class.mem/p2.cpp
a2e76f56c60dbd4de3dc0fed02bb01bea4dcff81 29-Apr-2012 Richard Smith <richard-llvm@metafoo.co.uk> [class.copy]p23: Fix an assertion caused by incorrect argument numbering in a
diagnostic, add a test for this paragraph, and tighten up the diagnostic wording
a little.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155784 91177308-0d34-0410-b5e6-96231b3b80d8
pecial/class.copy/p11.0x.copy.cpp
pecial/class.copy/p23-cxx11.cpp
pecial/class.ctor/p5-0x.cpp
pecial/class.dtor/p5-0x.cpp
a1366cbab89ec6d4f630dca91e85d03d9e5d1d7d 27-Apr-2012 Richard Smith <richard-llvm@metafoo.co.uk> PR12224 (sort of): Diagnose inheriting constructor declarations in C++11 mode.
We do not support IRGen for these, and get some parts of the semantic analysis
wrong.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155728 91177308-0d34-0410-b5e6-96231b3b80d8
pecial/class.inhctor/elsewhere.cpp
pecial/class.inhctor/p3.cpp
pecial/class.inhctor/p7.cpp
c799a6a5c884831c3c3ea57d30fbe4ab35709d49 26-Apr-2012 Richard Smith <richard-llvm@metafoo.co.uk> If a type is non-literal by virtue of being incomplete produce notes
explaining that.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155598 91177308-0d34-0410-b5e6-96231b3b80d8
asic/basic.types/p10.cpp
5d59b79c2fd8783900e52cf2dd6add5d3627b2fc 25-Apr-2012 Richard Smith <richard-llvm@metafoo.co.uk> PR12625: Cope with classes which have incomplete base or member types:
Don't try to query whether an incomplete type has a trivial copy constructor
when determining whether a move constructor should be declared.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155575 91177308-0d34-0410-b5e6-96231b3b80d8
pecial/class.copy/implicit-move.cpp
2b2a0876c9d3a92c5216a578373817974fe159a0 24-Apr-2012 Richard Smith <richard-llvm@metafoo.co.uk> Don't try to delay parsing the exception specification for a data member of a
class; we would never actually parse it and attach it to the type.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155426 91177308-0d34-0410-b5e6-96231b3b80d8
lass/class.mem/p2.cpp
8c614e4f2b07741130e6c99a971a7093358fb9e4 24-Apr-2012 Richard Smith <richard-llvm@metafoo.co.uk> PR12629: Cope with parenthesized function types when attaching a delayed
exception specification to a function.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155424 91177308-0d34-0410-b5e6-96231b3b80d8
lass/class.mem/p2.cpp
704c8f76bbe2de68375f7f146e75bd74de6dd518 20-Apr-2012 Richard Smith <richard-llvm@metafoo.co.uk> Fix bug where a class's (deleted) copy constructor would be implicitly given a
non-const reference parameter type if the class had any subobjects with deleted
copy constructors. This causes a rejects-valid if the class's copy constructor
is explicitly defaulted (as happens for some implementations of std::pair etc).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155218 91177308-0d34-0410-b5e6-96231b3b80d8
pecial/class.copy/implicit-move.cpp
pecial/class.copy/p8-cxx11.cpp
e6975e9b0985ad7f7ff9187e38d95bfe9ac4181b 17-Apr-2012 Richard Smith <richard-llvm@metafoo.co.uk> Implement DR1330 in C++11 mode, to support libstdc++4.7 which uses it.

We have a new flavor of exception specification, EST_Uninstantiated. A function
type with this exception specification carries a pointer to a FunctionDecl, and
the exception specification for that FunctionDecl is instantiated (if needed)
and used in the place of the function type's exception specification.

When a function template declaration with a non-trivial exception specification
is instantiated, the specialization's exception specification is set to this
new 'uninstantiated' kind rather than being instantiated immediately.

Expr::CanThrow has migrated onto Sema, so it can instantiate exception specs
on-demand. Also, any odr-use of a function triggers the instantiation of its
exception specification (the exception specification could be needed by IRGen).
In passing, fix two places where a DeclRefExpr was created but the corresponding
function was not actually marked odr-used. We used to get away with this, but
don't any more.

Also fix a bug where instantiating an exception specification which refers to
function parameters resulted in a crash. We still have the same bug in default
arguments, which I'll be looking into next.

This, plus a tiny patch to fix libstdc++'s common_type, is enough for clang to
parse (and, in very limited testing, support) all of libstdc++4.7's standard
headers.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154886 91177308-0d34-0410-b5e6-96231b3b80d8
xcept/except.spec/p1.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
lass/class.mem/p2.cpp
xpr/expr.prim/expr.prim.general/p3-0x.cpp
emp/temp.decls/temp.variadic/p5.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/expr.prim/expr.prim.general/p3-0x.cpp
a1c4f7c833093f87d5187c4449a3d4534cfa40a4 13-Apr-2012 Richard Smith <richard-llvm@metafoo.co.uk> PR12500: Improve the wording of the diagnostic for a redefinition of a name
in the wrong namespace scope. Patch by Jonathan Sauer!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154656 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.spec/temp.expl.spec/p2-0x.cpp
emp/temp.spec/temp.expl.spec/p2.cpp
50fadd19497f5fa6d8737786ba74af8354d28349 10-Apr-2012 Douglas Gregor <dgregor@apple.com> Improve diagnostics in C++11 when a non-type template argument for a
non-type template parameter of pointer type is not a constant expression.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154424 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.arg/temp.arg.nontype/p1-11.cpp
42963612a4187b55685b7f75489c11abd3fa100e 10-Apr-2012 Douglas Gregor <dgregor@apple.com> Rework implementation of null non-type template arguments based on
Richard's feedback, to properly catch non-constant expressions and
type mismatches. Finishes <rdar://problem/11193097>.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154407 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.arg/temp.arg.nontype/p1-11.cpp
6ee326af4e77e6f05973486097884d7431f2108d 10-Apr-2012 Richard Smith <richard-llvm@metafoo.co.uk> Disambiguation of '[[':
* In C++11, '[[' is ill-formed unless it starts an attribute-specifier. Reject
array sizes and array indexes which begin with a lambda-expression. Recover by
parsing the lambda as a lambda.
* In Objective-C++11, either '[' could be the start of a message-send.
Fully disambiguate this case: it turns out that the grammars of message-sends,
lambdas and attributes do not actually overlap. Accept any occurrence of '[['
where either '[' starts a message send, but reject a lambda in an array index
just like in C++11 mode.

Implement a couple of changes to the attribute wording which occurred after our
attributes implementation landed:
* In a function-declaration, the attributes go after the exception specification,
not after the right paren.
* A reference type can have attributes applied.
* An 'identifier' in an attribute can also be a keyword. Support for alternative
tokens (iso646 keywords) in attributes to follow.

And some bug fixes:
* Parse attributes after declarator-ids, even if they are not simple identifiers.
* Do not accept attributes after a parenthesized declarator.
* Accept attributes after an array size in a new-type-id.
* Partially disamiguate 'delete' followed by a lambda. More work is required
here for the case where the lambda-introducer is '[]'.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154369 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/dcl.attr/dcl.attr.grammar/p6.cpp
63f557804b76bf765aea58e5a46503e47e21f7c1 09-Apr-2012 John McCall <rjmccall@apple.com> My original patch missed the virtual-base case for destroying
base-class subojects.

Incidentally, thinking about virtual bases makes it clear to me that
we're not appropriately computing the access to the virtual base's
member because we're not computing the best possible access to the
virtual base at all; in fact, we're basically assuming it's public.
I'll file a separate PR about that.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154346 91177308-0d34-0410-b5e6-96231b3b80d8
lass.access/class.protected/p1.cpp
12d8d80fb0f8d9cddecb34da0f37b0dc9fcaf5e6 09-Apr-2012 John McCall <rjmccall@apple.com> Fix the access check performed as part of the determination of whether
to define a special member function as deleted so that it properly
establishes an object context for the accesses to the base subobject
members.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154343 91177308-0d34-0410-b5e6-96231b3b80d8
lass.access/class.protected/p1-cxx11.cpp
b9abd87283ac6e929b7e12a577663bc99e61d020 07-Apr-2012 John McCall <rjmccall@apple.com> Fix several problems with protected access control:
- The [class.protected] restriction is non-trivial for any instance
member, even if the access lacks an object (for example, if it's
a pointer-to-member constant). In this case, it is equivalent to
requiring the naming class to equal the context class.
- The [class.protected] restriction applies to accesses to constructors
and destructors. A protected constructor or destructor can only be
used to create or destroy a base subobject, as a direct result.
- Several places were dropping or misapplying object information.

The standard could really be much clearer about what the object type is
supposed to be in some of these accesses. Usually it's easy enough to
find a reasonable answer, but still, the standard makes a very confident
statement about accesses to instance members only being possible in
either pointer-to-member literals or member access expressions, which
just completely ignores concepts like constructor and destructor
calls, using declarations, unevaluated field references, etc.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154248 91177308-0d34-0410-b5e6-96231b3b80d8
lass.access/class.protected/p1.cpp
lass.access/p4.cpp
d2008e2c80d6c9282044ec873a937a17a0f33579 07-Apr-2012 Douglas Gregor <dgregor@apple.com> Implement support for null non-type template arguments for non-type
template parameters of pointer, pointer-to-member, or nullptr_t
type in C++11. Fixes PR9700 / <rdar://problem/11193097>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154219 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.arg/temp.arg.nontype/p1-11.cpp
e47029aead7afc823d4e2eaba00bce39f929a858 05-Apr-2012 Richard Smith <richard-llvm@metafoo.co.uk> Temporary workaround for bug#12457: turn the 'constexpr function never produces
a constant expression' error into a DefaultError ExtWarn, so that it can be
disabled and is suppressed in system headers. libstdc++4.7 contains some such
functions which we currently can't evaluate as constant expressions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154115 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/dcl.spec/dcl.constexpr/p5.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
lass/class.nest/p1.cpp
xpr/expr.prim/expr.prim.general/p12-0x.cpp
xpr/expr.prim/expr.prim.general/p4-0x.cpp
xpr/expr.prim/expr.prim.lambda/p12.cpp
pecial/class.free/p1.cpp
pecial/class.free/p6.cpp
e31b8fb25b458f00e31dcd657c0840e5238e0f05 05-Apr-2012 David Blaikie <dblaikie@gmail.com> Enable warn_impcast_literal_float_to_integer by default.

This diagnostic seems to be production ready, it's just an oversight that it
wasn't turned on by default.

The test changes are a bit of a mixed bag. Some tests that seemed like they
clearly didn't need to use this behavior have been modified not to use it.
Others that I couldn't be sure about, I added the necessary expected-warnings
to.

It's possible the diagnostic message could be improved to make it clearer that
this warning can be suppressed by using a value that won't lose precision when
converted to the target type (but can still be a floating point literal, such
as "bool b = 1.0;").

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154068 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.spec/p5.cpp
397f32712369bfed739fe3cb180604b472b41942 04-Apr-2012 Richard Smith <richard-llvm@metafoo.co.uk> Hardcode a triple to prevent the test failing on targets which don't support __thread.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154058 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.arg/temp.arg.nontype/p1.cpp
b4051e7047a0085f0679257386ff183aed3e5162 04-Apr-2012 Richard Smith <richard-llvm@metafoo.co.uk> Implement C++11 [temp.arg.nontype]'s permission to use the address of an object
or function with internal linkage as a non-type template argument.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154053 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.arg/temp.arg.nontype/p1.cpp
a9b55a499a8b5ae0c4b373f751ef62af74ec494e 04-Apr-2012 Douglas Gregor <dgregor@apple.com> Dependent-sequence initialization of a single element can be direct
list-initialization. Loosen an over-eager assertion to fix PR12453.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153995 91177308-0d34-0410-b5e6-96231b3b80d8
cl.decl/dcl.init/dcl.init.list/basic.cpp
e14ba2cec3807df892917171b590bac25b779b46 04-Apr-2012 John McCall <rjmccall@apple.com> When computing the conversion sequence in overload resolution
for converting an empty list to a scalar, be sure to initialize
the source and destination types so that comparison of conversion
sequences will work in case there are multiple viable candidates.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153993 91177308-0d34-0410-b5e6-96231b3b80d8
ver/over.match/over.match.best/over.best.ics/over.ics.list/p6.cpp
e6af6604b905435456f49cd4a37da0ce6e505c38 02-Apr-2012 Richard Smith <richard-llvm@metafoo.co.uk> PR10217 diagnostic fix: don't say 'copy constructor' when we mean
'copy assignment operator'.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153897 91177308-0d34-0410-b5e6-96231b3b80d8
pecial/class.copy/implicit-move.cpp
5bdaac5454d93d1dcdc2319818497b685be56fcf 02-Apr-2012 Richard Smith <richard-llvm@metafoo.co.uk> Finish PR10217: Ensure we say that a special member was implicitly, not
explicitly, deleted in all relevant cases, and explain why.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153894 91177308-0d34-0410-b5e6-96231b3b80d8
pecial/class.copy/implicit-move.cpp
pecial/class.ctor/p5-0x.cpp
pecial/class.dtor/p5-0x.cpp
1c931be1873f8c20cdcb5060c84570cd3359aa02 02-Apr-2012 Richard Smith <richard-llvm@metafoo.co.uk> Implement DR1402: if a field or base class is not movable, the derived class's
move constructor/move assignment operator are not declared, rather than being
defined as deleted, so move operations on the derived class fall back to
copying rather than moving.

If a move operation on the derived class is explicitly defaulted, the
unmovable subobject will be copied instead of being moved.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153883 91177308-0d34-0410-b5e6-96231b3b80d8
pecial/class.copy/implicit-move.cpp
pecial/class.copy/p11.0x.move.cpp
c5a89a1cc2f168ad0a115c560b8de5f1c952d8c5 02-Apr-2012 Richard Smith <richard-llvm@metafoo.co.uk> Basic semantic analysis support for inheriting constructor declarations in
dependent contexts.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153858 91177308-0d34-0410-b5e6-96231b3b80d8
pecial/class.inhctor/elsewhere.cpp
pecial/class.inhctor/p3.cpp
pecial/class.inhctor/p7.cpp
6c4c36c4ed1007143f5b8655eb68b313a7e12e76 30-Mar-2012 Richard Smith <richard-llvm@metafoo.co.uk> PR10217: Provide diagnostics explaining why an implicitly-deleted special
member function is deleted.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153773 91177308-0d34-0410-b5e6-96231b3b80d8
cl.decl/dcl.init/dcl.init.aggr/p1-0x.cpp
pecial/class.copy/implicit-move.cpp
pecial/class.copy/p11.0x.copy.cpp
pecial/class.copy/p11.0x.move.cpp
pecial/class.ctor/p5-0x.cpp
pecial/class.dtor/p5-0x.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/expr.const/p3-0x-nowarn.cpp
6960587df0bd1b421c11715807a4d2302a3aae3c 28-Mar-2012 Douglas Gregor <dgregor@apple.com> Unify and fix our checking of C++ [dcl.meaning]p1's requirements
concerning qualified declarator-ids. We now diagnose extraneous
qualification at namespace scope (which we had previously missed) and
diagnose these qualification errors for all kinds of declarations; it
was rather uneven before. Fixes <rdar://problem/11135644>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153577 91177308-0d34-0410-b5e6-96231b3b80d8
cl.decl/dcl.meaning/p1.cpp
emp/p3.cpp
1af83c444e5a2f6f50a6e1c15e6ebc618ae18a5f 23-Mar-2012 Richard Smith <richard-llvm@metafoo.co.uk> Support for definitions of member enumerations of class templates outside the
class template's definition, and for explicit specializations of such enum
members.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153304 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.class/temp.mem.enum/p1.cpp
emp/temp.spec/temp.explicit/p1-0x.cpp
42aceadbc3806868cee8ac576347d258ac99e1f6 18-Mar-2012 Douglas Gregor <dgregor@apple.com> Diagnose tag and class template declarations with qualified
declarator-ids that occur at class scope. Fixes PR8019.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153002 91177308-0d34-0410-b5e6-96231b3b80d8
lass.access/p4.cpp
cl.decl/dcl.meaning/p1.cpp
1d23c4219527d9a2bc75f5cdb1ffcaefb8bcc61b 15-Mar-2012 David Blaikie <dblaikie@gmail.com> Unpluralize -Wfoo-conversions warnings for consistency.

Err on the side of brevity and rename (while providing aliases for the original
name) -Wbool-conversions, -Wint-conversions, and -Wvector-conversions for
consistency with constant, literal, string, and sign conversion warnings. And
name the diagnostic groups explicitly while I'm here rather than rewriting the
string in the groups and sema td files.

Curiously, vector-conversion is not under -Wconversion. Perhaps it should be.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152776 91177308-0d34-0410-b5e6-96231b3b80d8
ver/over.over/p2-resolve-single-template-id.cpp
f1c66b40213784a1c4612f04c14cafa2b0e89988 15-Mar-2012 Richard Smith <richard-llvm@metafoo.co.uk> Instantiating a class template should not instantiate the definition of any
scoped enumeration members. Later uses of an enumeration temploid as a nested
name specifier should cause its instantiation. Plus some groundwork for
explicit specialization of member enumerations of class templates.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152750 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.spec/temp.explicit/p8.cpp
emp/temp.spec/temp.inst/p1.cpp
e37f484ab9a65ce4e5f90adcfa20add4215e0783 13-Mar-2012 Richard Smith <richard-llvm@metafoo.co.uk> Implement [temp.param]p5: the top-level cv-qualifiers on a non-type template
parameter's declaration are ignored when determining the parameter's type.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152619 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.param/p5.cpp
7c5d28b6342229fb648aea59dc063f67ff16bc81 13-Mar-2012 Richard Smith <richard-llvm@metafoo.co.uk> PR11850 + duplicates: don't assume that a function parameter pack expansion is
at the end of the parameter list.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152618 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.variadic/p4.cpp
1b7f9cbed1b96b58a6e5f7808ebc9345a76a0936 13-Mar-2012 Richard Smith <richard-llvm@metafoo.co.uk> Fix PR10447: lazily building name lookup tables for DeclContexts was broken.
The deferred lookup table building step couldn't accurately tell which Decls
should be included in the lookup table, and consequently built different tables
in some cases.

Fix this by removing lazy building of DeclContext name lookup tables. In
practice, the laziness was frequently not worthwhile in C++, because we
performed lookup into most DeclContexts. In C, it had a bit more value,
since there is no qualified lookup.

In the place of lazy lookup table building, we simply don't build lookup tables
for function DeclContexts at all. Such name lookup tables are not useful, since
they don't capture the scoping information required to correctly perform name
lookup in a function scope.

The resulting performance delta is within the noise on my testing, but appears
to be a very slight win for C++ and a very slight loss for C. The C performance
can probably be recovered (if it is a measurable problem) by avoiding building
the lookup table for the translation unit.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152608 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/basic.namespace/namespace.udecl/p11.cpp
860d9b780b54f56cd27e16620196d213385d31f7 12-Mar-2012 Douglas Gregor <dgregor@apple.com> C++11 [temp.deduct.call]p6 tweak: when given a set of overlaoded
functions that includes an explicit template argument list, perform
an inner deduction against each of the function templates in that list
and, if successful, use the result of that deduction for the outer
template argument deduction. Fixes PR11713.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152575 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.fct.spec/temp.deduct/temp.deduct.call/p6.cpp
7796eb5643244f3134834253ce5ea89107ac21c1 12-Mar-2012 Richard Smith <richard-llvm@metafoo.co.uk> Fix parsing of trailing-return-type. Types are syntactically prohibited from
being defined here: [] () -> struct S {} does not define struct S.

In passing, implement DR1318 (syntactic disambiguation of 'final').


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152551 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p2.cpp
cl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p5.cpp
cl.decl/dcl.meaning/dcl.fct/p9-0x.cpp
69730c115c2d0fec2f20609d905d920a5a41b29b 12-Mar-2012 Richard Smith <richard-llvm@metafoo.co.uk> Fix parsing of type-specifier-seq's. Types are syntactically allowed to be
defined here, but not semantically, so

new struct S {};

is always ill-formed, even if there is a struct S in scope.

We also had a couple of bugs in ParseOptionalTypeSpecifier caused by it being
under-loved (due to it only being used in a few places) so merge it into
ParseDeclarationSpecifiers with a new DeclSpecContext. To avoid regressing, this
required improving ParseDeclarationSpecifiers' diagnostics in some cases. This
also required teaching ParseSpecifierQualifierList about constexpr... which
incidentally fixes an issue where we'd allow the constexpr specifier in other
bad places.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152549 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/dcl.spec/dcl.type/p3-0x.cpp
cl.dcl/dcl.spec/dcl.typedef/p2-0x.cpp
cl.decl/dcl.name/p1.cpp
fc55a8290a3e81111c0a373e1a04b09dd7da0b98 11-Mar-2012 Douglas Gregor <dgregor@apple.com> When template argument deduction is ignoring qualifiers, perform deep
structural comparison of non-dependent types. Otherwise, we end up
rejecting cases where the non-dependent types don't match due to
qualifiers in, e.g., a pointee type. Fixes PR12132.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152529 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.fct.spec/temp.deduct/temp.deduct.call/p4.cpp
5a7a5bb20904a1d34255b772c87b930e798f59a8 11-Mar-2012 Douglas Gregor <dgregor@apple.com> When determining whether an identifier followed by a '<' in a member
access expression is the start of a template-id, ignore function
templates found in the context of the entire postfix-expression. Fixes
PR11856.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152520 91177308-0d34-0410-b5e6-96231b3b80d8
asic/basic.lookup/basic.lookup.classref/p1.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/expr.unary/expr.new/p17-crash.cpp
xpr/expr.unary/expr.new/p17.cpp
e5658f0ab2a6f8fea258adb64edbb8485bb21dee 10-Mar-2012 Richard Smith <richard-llvm@metafoo.co.uk> PR12225: The requirement that literal operators be namespace-scope functions
does not imply that such functions can't be declared at block scope.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152509 91177308-0d34-0410-b5e6-96231b3b80d8
ver/over.oper/over.literal/p2.cpp
26b75c07317a3b50a8a00a1623e3ef38af1d8349 09-Mar-2012 Richard Smith <richard-llvm@metafoo.co.uk> Improve diagnostics for UCNs referring to control characters and members of the
basic source character set in C++98. Add -Wc++98-compat diagnostics for same in
literals in C++11. Extend such support to cover string literals as well as
character literals, and mark N2170 as done.

This seems too minor to warrant a release note to me. Let me know if you disagree.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152444 91177308-0d34-0410-b5e6-96231b3b80d8
ex/lex.charset/p2-cxx11.cpp
ex/lex.charset/p2-cxx98.cpp
15debc31f27e35acd9fa1956cefc0294f4e13cb1 09-Mar-2012 Benjamin Kramer <benny.kra@googlemail.com> Harden test for 32 bit platforms, where size_t is unsigned int (not unsigned long).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152404 91177308-0d34-0410-b5e6-96231b3b80d8
ex/lex.literal/lex.ext/p2.cpp
3a5032b89df601ab2e0c5c7e9667db2301bf10cf 09-Mar-2012 Richard Smith <richard-llvm@metafoo.co.uk> Literal operator suffixes and regular names live in separate namespaces.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152395 91177308-0d34-0410-b5e6-96231b3b80d8
ver/over.oper/over.literal/p2.cpp
a9e88b2549add9766382c70d270dfd89fa33f7cf 09-Mar-2012 Richard Smith <richard-llvm@metafoo.co.uk> Literal operators can't have default arguments.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152394 91177308-0d34-0410-b5e6-96231b3b80d8
ver/over.oper/over.literal/p3.cpp
36f5cfe4df32af6c5fe01228102512996f566f9d 09-Mar-2012 Richard Smith <richard-llvm@metafoo.co.uk> Support for raw and template forms of numeric user-defined literals,
and lots of tidying up.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152392 91177308-0d34-0410-b5e6-96231b3b80d8
ex/lex.literal/lex.ext/p2.cpp
ex/lex.literal/lex.ext/p3.cpp
ex/lex.literal/lex.ext/p4.cpp
ex/lex.literal/lex.ext/p5.cpp
ex/lex.literal/lex.ext/p6.cpp
ex/lex.literal/lex.ext/p7.cpp
e093404ee9fc6fc169304b51ec2f78ffafef16b9 09-Mar-2012 Richard Smith <richard-llvm@metafoo.co.uk> Remove a test FIXME for a case which is already fixed.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152349 91177308-0d34-0410-b5e6-96231b3b80d8
ex/lex.literal/lex.ext/p10.cpp
2fb4ae36825ca3a0cbe7e845c5747062870066be 08-Mar-2012 Richard Smith <richard-llvm@metafoo.co.uk> Implement C++11 [lex.ext]p10 for string and character literals: a ud-suffix not
starting with an underscore is ill-formed.

Since this rule rejects programs that were using <inttypes.h>'s macros, recover
from this error by treating the ud-suffix as a separate preprocessing-token,
with a DefaultError ExtWarn. The approach of treating such cases as two tokens
is under discussion for standardization, but is in any case a conforming
extension and allows existing codebases to keep building while the committee
makes up its mind.

Reword the warning on the definition of literal operators not starting with
underscores (which are, strangely, legal) to more explicitly state that such
operators can't be called by literals. Remove the special-case diagnostic for
hexfloats, since it was both triggering in the wrong cases and incorrect.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152287 91177308-0d34-0410-b5e6-96231b3b80d8
ex/lex.literal/lex.ext/p1.cpp
ex/lex.literal/lex.ext/p10.cpp
ver/over.oper/over.literal/p8.cpp
9fcce65e7e1307b5b8da9be13e4092d6bb94dc1d 07-Mar-2012 Richard Smith <richard-llvm@metafoo.co.uk> AST representation for user-defined literals, plus just enough of semantic
analysis to make the AST representation testable. They are represented by a
new UserDefinedLiteral AST node, which is a sugared CallExpr. All semantic
properties, including full CodeGen support, are achieved for free by this
representation.

UserDefinedLiterals can never be dependent, so no custom instantiation
behavior is required. They are mangled as if they were direct calls to the
underlying literal operator. This matches g++'s apparent behavior (but not its
actual mangling, which is broken for literal-operator-ids).

User-defined *string* literals are now fully-operational, but the semantic
analysis is quite hacky and needs more work. No other forms of user-defined
literal are created yet, but the AST support for them is present.

This patch committed after midnight because we had already hit the quota for
new kinds of literal yesterday.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152211 91177308-0d34-0410-b5e6-96231b3b80d8
ex/lex.literal/lex.ext/p10.cpp
ex/lex.literal/lex.ext/p8.cpp
ex/lex.literal/lex.ext/p9.cpp
99831e4677a7e2e051af636221694d60ba31fcdb 06-Mar-2012 Richard Smith <richard-llvm@metafoo.co.uk> User-defined literals: reject string and character UDLs in all places where the
grammar requires a string-literal and not a user-defined-string-literal. The
two constructs are still represented by the same TokenKind, in order to prevent
a combinatorial explosion of different kinds of token. A flag on Token tracks
whether a ud-suffix is present, in order to prevent clients from needing to look
at the token's spelling.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152098 91177308-0d34-0410-b5e6-96231b3b80d8
ver/over.oper/over.literal/p8.cpp
0cc323c6bed7206f9743a9775ec8d9cb90655f9c 06-Mar-2012 Richard Smith <richard-llvm@metafoo.co.uk> static_assert: Allow any string-literal as the message, not just a character
string literal, and adjust the diagnostic code to match. This also causes us
to escape any control characters in the message.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152069 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/p4-0x.cpp
d4f9f9dfdfa36f2e45c2ad0f4be304737d0f7f64 05-Mar-2012 Richard Smith <richard-llvm@metafoo.co.uk> More tests for r152012.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152013 91177308-0d34-0410-b5e6-96231b3b80d8
ex/lex.literal/lex.ext/p10.cpp
ex/lex.literal/lex.ext/p8.cpp
ex/lex.literal/lex.ext/p9.cpp
5cc2c6eb67b6e5361bbe96f79b519fd62ec666d6 05-Mar-2012 Richard Smith <richard-llvm@metafoo.co.uk> Lexing support for user-defined literals. Currently these lex as the same token
kinds as the underlying string literals, and we silently drop the ud-suffix;
those issues will be fixed by subsequent patches.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152012 91177308-0d34-0410-b5e6-96231b3b80d8
ex/lex.literal/lex.ext/p1.cpp
ver/over.oper/over.literal/p5.cpp
ver/over.oper/over.literal/p8.cpp
b4a7b1e587a232c95d02a8ca10eeba60164fbba1 04-Mar-2012 Richard Smith <richard-llvm@metafoo.co.uk> Add tests for [over.literal]. Fix a few bugs which were exposed by the tests.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151997 91177308-0d34-0410-b5e6-96231b3b80d8
ver/over.oper/over.literal/p2.cpp
ver/over.oper/over.literal/p3.cpp
ver/over.oper/over.literal/p5.cpp
ver/over.oper/over.literal/p6.cpp
ver/over.oper/over.literal/p7.cpp
ver/over.oper/over.literal/p8.cpp
ec92bc78979aae6ec436fe51d082f7467e6f96c0 04-Mar-2012 Richard Smith <richard-llvm@metafoo.co.uk> Add a pile of tests for unrestricted unions, and advertise support for them.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151992 91177308-0d34-0410-b5e6-96231b3b80d8
pecial/class.copy/p11.0x.copy.cpp
pecial/class.copy/p11.0x.move.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/expr.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/expr.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/expr.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/expr.ass/p9-cxx11.cpp
79363f5e612c17cd05e1fa888632ee7860ced1ab 27-Feb-2012 Richard Smith <richard-llvm@metafoo.co.uk> Ensure that we delete default constructors in the right cases. Don't delete the
default constructor of a union if it has a const member with no user-provided
default constructor.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151516 91177308-0d34-0410-b5e6-96231b3b80d8
pecial/class.ctor/p5-0x.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/expr.ass/p9-cxx11.cpp
ea7c1e24f33c554aeac07dc4f6dc7493dd98e272 26-Feb-2012 Richard Smith <richard-llvm@metafoo.co.uk> Don't assert when trying to diagnose why a class with a constructor template is
non-trivial.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151486 91177308-0d34-0410-b5e6-96231b3b80d8
lass/class.union/p1.cpp
9a561d539158a30b68fc258b81a994f3fac10212 26-Feb-2012 Richard Smith <richard-llvm@metafoo.co.uk> Ensure that we delete destructors in the right cases. Specifically:
- variant members with nontrivial destructors make the containing class's
destructor deleted
- check for a virtual destructor after checking for overridden methods in the
base class(es)
- check for an inaccessible operator delete for a class with a virtual
destructor.

Do not try to call an anonymous union field's destructor from the destructor of
the containing class.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151483 91177308-0d34-0410-b5e6-96231b3b80d8
pecial/class.dtor/p5-0x.cpp
e653ba2f3b6d993b5d410554c12416c03ec7775b 26-Feb-2012 Richard Smith <richard-llvm@metafoo.co.uk> Special members which are defaulted or deleted on their first declaration are
trivial if the implicit declaration would be. Don't forget to set the Trivial
flag on the special member as well as on the class. It doesn't seem ideal that
we have two separate mechanisms for storing this information, but this patch
does not attempt to address that.

This leaves us in an interesting position where the has_trivial_X trait for a
class says 'yes' for a deleted but trivial X, but is_trivially_Xable says 'no'.
This seems to be what the standard requires.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151465 91177308-0d34-0410-b5e6-96231b3b80d8
cl.decl/dcl.fct.def/dcl.fct.def.default/p2.cpp
pecial/class.ctor/p5-0x.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/expr.prim/expr.prim.general/p12-0x.cpp
9b42afdccc9f4b32ed4f83492f87e2cd0518f9f3 25-Feb-2012 Douglas Gregor <dgregor@apple.com> Add test for C++ DR899.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151411 91177308-0d34-0410-b5e6-96231b3b80d8
ver/over.match/over.match.funcs/over.match.copy/p1.cpp
ed878af7914df535b32d64f555fa118413186672 25-Feb-2012 Douglas Gregor <dgregor@apple.com> Implement C++11 [over.match.copy]p1b2, which allows the use of
explicit conversion functions to initialize the argument to a
copy/move constructor that itself is the subject of direct
initialization. Since we don't have that much context in overload
resolution, we end up threading more flags :(.

Fixes <rdar://problem/10903741> / PR10456.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151409 91177308-0d34-0410-b5e6-96231b3b80d8
ver/over.match/over.match.funcs/over.match.copy/p1.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/expr.prim/expr.prim.lambda/blocks.mm
0635aa75ab48c9c3b4269d266305aba77b6ec58e 22-Feb-2012 Richard Smith <richard-llvm@metafoo.co.uk> Accept braced-init-lists in conditions, and, in passing, dramatically improve
the diagnostic for using a parenthesized direct-initializer in a condition.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151137 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p3.cpp
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/expr.prim/expr.prim.lambda/blocks.cpp
xpr/expr.prim/expr.prim.lambda/blocks.mm
e9ee382c32a83e9807a2fe4cfd52b5a11169a4b8 22-Feb-2012 Eli Friedman <eli.friedman@gmail.com> Improve diagnostics a bit for bad member initializers, and fix an obscure bug involving packs. Fixes PR12049.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151130 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.variadic/p4.cpp
76f3f69db1416425070177243e9f390122c553e0 22-Feb-2012 Richard Smith <richard-llvm@metafoo.co.uk> Implement C++11 [expr.call]p11: If the operand to a decltype-specifier is a
function call (or a comma expression with a function call on its right-hand
side), possibly parenthesized, then the return type is not required to be
complete and a temporary is not bound. Other subexpressions inside a decltype
expression do not get this treatment.

This is implemented by deferring the relevant checks for all calls immediately
within a decltype expression, then, when the expression is fully-parsed,
checking the relevant constraints and stripping off any top-level temporary
binding.

Deferring the completion of the return type exposed a bug in overload
resolution where completion of the argument types was not attempted, which
is also fixed by this change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151117 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/dcl.spec/dcl.type/dcl.type.simple/p5-cxx0x.cpp
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/expr.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/expr.prim/expr.prim.lambda/p13.cpp
ee0653963537f6ea60f655856fb0c83d7d4010db 21-Feb-2012 Eli Friedman <eli.friedman@gmail.com> Make RequireLiteralType work correctly with incomplete array types. PR12037.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151005 91177308-0d34-0410-b5e6-96231b3b80d8
asic/basic.types/p10.cpp
ff2348888133dcc64f7363af2093cb608caeb7ce 21-Feb-2012 Richard Smith <richard-llvm@metafoo.co.uk> Fix a constexpr FIXME: When implicitly instantiating the primary template for an
explicit specialization of a function template, mark the instantiation as
constexpr if the specialization is, rather than requiring them to match.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151001 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/dcl.spec/dcl.constexpr/p1.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/expr.prim/expr.prim.lambda/blocks.cpp
xpr/expr.prim/expr.prim.lambda/p16.cpp
xpr/expr.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/expr.prim/expr.prim.lambda/p16.cpp
xpr/expr.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/expr.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/expr.prim/expr.prim.lambda/templates.cpp
449d4f06fe7501ed53e3aaaa465a499442285e90 16-Feb-2012 Richard Smith <richard-llvm@metafoo.co.uk> Make sure we still reject static data members in anonymous unions in C++11.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150724 91177308-0d34-0410-b5e6-96231b3b80d8
lass/class.union/p2-0x.cpp
b9c64d84ea3edd5e2fffb0a2e85ca1308be4f429 16-Feb-2012 Richard Smith <richard-llvm@metafoo.co.uk> C++11 allows unions to have static data members. Remove the corresponding
restriction and add some tests.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150721 91177308-0d34-0410-b5e6-96231b3b80d8
lass/class.union/p1.cpp
lass/class.union/p2-0x.cpp
74e1ad93fa8d6347549bcb10279fdf1fbc775321 16-Feb-2012 Richard Smith <richard-llvm@metafoo.co.uk> constexpr tidyups:
* Fix bug when determining whether && / || are potential constant expressions
* Try harder when determining whether ?: is a potential constant expression
* Produce a diagnostic on sizeof(VLA) to provide a better source location


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150657 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/dcl.spec/dcl.constexpr/p5.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/expr.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/expr.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
cl.decl/dcl.init/dcl.init.aggr/p1-0x.cpp
xpr/expr.prim/expr.prim.lambda/p19.cpp
pecial/class.copy/implicit-move.cpp
pecial/class.copy/p11.0x.copy.cpp
pecial/class.ctor/p5-0x.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/expr.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/expr.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/expr.prim/expr.prim.lambda/p5.cpp
xpr/expr.prim/expr.prim.lambda/p7.cpp
xpr/expr.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/expr.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/expr.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/expr.prim/expr.prim.lambda/default-arguments.cpp
xpr/expr.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/expr.prim/expr.prim.lambda/p4.cpp
xpr/expr.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/expr.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/expr.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/expr.prim/expr.prim.lambda/templates.cpp
7ca4850a3e3530fa6c93b64b740446e32c97f992 13-Feb-2012 Richard Smith <richard-llvm@metafoo.co.uk> Deal with a horrible C++11 special case. If a non-literal type has a constexpr
constructor, and that constructor is used to initialize an object of static
storage duration such that all members and bases are initialized by constant
expressions, constant initialization is performed. In this case, the object
can still have a non-trivial destructor, and if it does, we must emit a dynamic
initializer which performs no initialization and instead simply registers that
destructor.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150419 91177308-0d34-0410-b5e6-96231b3b80d8
lass/class.static/class.static.data/p3.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/expr.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
asic/basic.types/p10.cpp
lass/class.static/class.static.data/p3.cpp
cl.dcl/dcl.spec/dcl.constexpr/p1.cpp
cl.dcl/dcl.spec/dcl.constexpr/p3.cpp
cl.dcl/dcl.spec/dcl.constexpr/p4.cpp
cl.dcl/dcl.spec/dcl.constexpr/p6.cpp
cl.dcl/dcl.spec/dcl.constexpr/p9.cpp
xpr/expr.const/p2-0x.cpp
pecial/class.ctor/p6-0x.cpp
6d9ef30c5026e80fb398ed32bcdf69e4d714f033 12-Feb-2012 Douglas Gregor <dgregor@apple.com> Implement the standard decltype() semantics described in C++11
[dcl.type.simple]p4, which treats all xvalues as returning T&&. We had
previously implemented a pre-standard variant of decltype() that
doesn't cope with, e.g., static_ast<T&&>(e) very well.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150348 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/dcl.spec/dcl.type/dcl.type.simple/p4-cxx0x.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/expr.prim/expr.prim.lambda/p12.cpp
xpr/expr.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/expr.prim/expr.prim.lambda/p19.cpp
xpr/expr.prim/expr.prim.lambda/p20.cpp
xpr/expr.prim/expr.prim.lambda/p5.cpp
xpr/expr.prim/expr.prim.lambda/p7.cpp
5b9cc5df25c2198f270dd1d5c438fdce70d4051d 12-Feb-2012 Sebastian Redl <sebastian.redl@getdesigned.at> Represent C++ direct initializers as ParenListExprs before semantic analysis
instead of having a special-purpose function.

- ActOnCXXDirectInitializer, which was mostly duplication of
AddInitializerToDecl (leading e.g. to PR10620, which Eli fixed a few days
ago), is dropped completely.
- MultiInitializer, which was an ugly hack I added, is dropped again.
- We now have the infrastructure in place to distinguish between
int x = {1};
int x({1});
int x{1};
-- VarDecl now has getInitStyle(), which indicates which of the above was used.
-- CXXConstructExpr now has a flag to indicate that it represents list-
initialization, although this is not yet used.
- InstantiateInitializer was renamed to SubstInitializer and simplified.
- ActOnParenOrParenListExpr has been replaced by ActOnParenListExpr, which
always produces a ParenListExpr. Placed that so far failed to convert that
back to a ParenExpr containing comma operators have been fixed. I'm pretty
sure I could have made a crashing test case before this.

The end result is a (I hope) considerably cleaner design of initializers.
More importantly, the fact that I can now distinguish between the various
initialization kinds means that I can get the tricky generalized initializer
test cases Johannes Schaub supplied to work. (This is not yet done.)

This commit passed self-host, with the resulting compiler passing the tests. I
hope it doesn't break more complicated code. It's a pretty big change, but one
that I feel is necessary.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150318 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.variadic/p5.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/expr.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/expr.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/expr.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/expr.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/expr.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/expr.prim/expr.prim.lambda/p7.cpp
d37b360bf9f954af119c9805fdc79ab9d30e06c6 10-Feb-2012 Richard Smith <richard-llvm@metafoo.co.uk> PR11684, core issue 1417:

o Correct the handling of the restrictions on usage of cv-qualified and
ref-qualified function types.
o Fix a bug where such types were rejected in template type parameter default
arguments, due to such arguments not being treated as a template type arg
context.
o Remove the ExtWarn for usage of such types as template arguments; that was
a standard defect, not a GCC extension.
o Improve the wording and unify the code for diagnosing cv-qualifiers with the
code for diagnosing ref-qualifiers.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150244 91177308-0d34-0410-b5e6-96231b3b80d8
lass/class.friend/p1.cpp
cl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p5.cpp
cl.dcl/dcl.spec/dcl.typedef/p2-0x.cpp
cl.decl/dcl.meaning/dcl.fct/p6-0x.cpp
cl.decl/dcl.meaning/dcl.fct/p6.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/expr.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/expr.prim/expr.prim.lambda/p10.cpp
xpr/expr.prim/expr.prim.lambda/p11.cpp
xpr/expr.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/expr.prim/expr.prim.lambda/p5.cpp
xpr/expr.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/expr.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/expr.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/expr.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/expr.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
lass/class.local/p1-0x.cpp
xpr/expr.prim/expr.prim.lambda/blocks.cpp
xpr/expr.prim/expr.prim.lambda/p10.cpp
xpr/expr.prim/expr.prim.lambda/p14.cpp
xpr/expr.prim/expr.prim.lambda/p15.cpp
xpr/expr.prim/expr.prim.lambda/p2.cpp
xpr/expr.prim/expr.prim.lambda/p3.cpp
xpr/expr.prim/expr.prim.lambda/p5.cpp
xpr/expr.prim/expr.prim.lambda/p7.cpp
xpr/expr.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/expr.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/expr.prim/expr.prim.lambda/p2.cpp
30ecfad3af057bff74d1c98099eda0677525574e 09-Feb-2012 Richard Smith <richard-llvm@metafoo.co.uk> DR1359: A constexpr constructor does not need to initialize an empty struct or
empty union. This still rejects anonymous member structs or unions which only
contain such empty class types, pending standard wording defining exactly what
an empty class type is.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150157 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/dcl.spec/dcl.constexpr/p4.cpp
b4e5e286a5cd156247720b1eb204abaa8e09568d 09-Feb-2012 Richard Smith <richard-llvm@metafoo.co.uk> CWG issue 1405: mutable members are allowed in literal types, but can't undergo
lvalue-to-rvalue conversions in constant expressions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150145 91177308-0d34-0410-b5e6-96231b3b80d8
asic/basic.types/p10.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/expr.prim/expr.prim.lambda/p14.cpp
xpr/expr.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/expr.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
lass/class.local/p1-0x.cpp
xpr/expr.prim/expr.prim.lambda/p10.cpp
xpr/expr.prim/expr.prim.lambda/p14.cpp
xpr/expr.prim/expr.prim.lambda/p15.cpp
xpr/expr.prim/expr.prim.lambda/p5.cpp
xpr/expr.prim/expr.prim.lambda/p7.cpp
xpr/expr.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/expr.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/expr.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/expr.prim/expr.prim.lambda/p15.cpp
xpr/expr.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/expr.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
cl.dcl/p4-0x.cpp
xpr/expr.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/expr.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/expr.prim/expr.prim.lambda/p14.cpp
xpr/expr.prim/expr.prim.lambda/p15.cpp
0a29422eb722c0ffbb98b98d8636042b19069f1a 07-Feb-2012 Eli Friedman <eli.friedman@gmail.com> Misc improvements to the diagnostic when a variable is odr-used in a context that is not allowed to capture variables.

Fixes PR11883.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149937 91177308-0d34-0410-b5e6-96231b3b80d8
lass/class.local/p1-0x.cpp
lass/class.local/p1.cpp
lass/class.local/p3.cpp
d79093af384ac0ea78f4237a001eae7467e06a61 05-Feb-2012 Richard Smith <richard-llvm@metafoo.co.uk> constexpr: Implement DR1358: An instantiation of a constexpr function which
can't produce a constant expression is not ill-formed (so long as some
instantiation of that function can produce a constant expression).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149802 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/dcl.spec/dcl.constexpr/p5.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/expr.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
xcept/except.spec/p1.cpp
xpr/expr.const/p2-0x.cpp
a506586ad3cb0f3635b0e77b86e5e9e5fb2ccc17 04-Feb-2012 Richard Smith <richard-llvm@metafoo.co.uk> Disallow constexpr main.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149770 91177308-0d34-0410-b5e6-96231b3b80d8
asic/basic.start/basic.start.main/p2i.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/expr.prim/expr.prim.lambda/blocks.cpp
b70126a328f89937f46db42f9e3cba1592887c91 03-Feb-2012 Douglas Gregor <dgregor@apple.com> When a pack expansion occurs in the template argument list of an alias
template without a corresponding parameter pack, don't immediately
substitute the alias template. This is under discussion in the C++
committee, and may become ill-formed, but for now we match GCC.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149697 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.variadic/fixed-expansion.cpp
8fbbae532e3cb5f45e9e862c60d48c78b0997325 03-Feb-2012 Douglas Gregor <dgregor@apple.com> Implement support for a pack expansion into a fixed-length
template. Such pack expansions can easily fail at template
instantiation time, if the expanded parameter packs are of the wrong
length. Fixes <rdar://problem/10040867>, PR9021, and the example that
came up today at Going Native.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149685 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.variadic/fixed-expansion.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
cl.dcl/dcl.spec/dcl.constexpr/p5.cpp
xpr/expr.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/expr.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/expr.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/expr.const/p2-0x.cpp
8398cbfc73f7ff0a676232db9ea9160bb9dafd8d 01-Feb-2012 Richard Smith <richard-llvm@metafoo.co.uk> constexpr: Unlike other incomplete types, 'void' cannot possibly be completed as
a literal type. Disallow it as the return type of a constexpr function
declaration.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149469 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/dcl.spec/dcl.constexpr/p3.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/expr.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/expr.prim/expr.prim.lambda/p10.cpp
xpr/expr.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/expr.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/expr.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/expr.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/expr.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/expr.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/expr.const/p2-0x.cpp
745f5147e065900267c85a5568785a1991d4838f 27-Jan-2012 Richard Smith <richard-llvm@metafoo.co.uk> constexpr: Implement the [dcl.constexpr]p5 check for whether a constexpr
function definition can produce a constant expression. This also provides the
last few checks for [dcl.constexpr]p3 and [dcl.constexpr]p4.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149108 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/dcl.spec/dcl.constexpr/p3.cpp
cl.dcl/dcl.spec/dcl.constexpr/p4.cpp
cl.dcl/dcl.spec/dcl.constexpr/p5.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/expr.post/expr.type.conv/p1-0x.cpp
tmt.stmt/stmt.ambig/p1-0x.cpp
b832f6dea893f25b40500a04781286236281cb20 23-Jan-2012 Sebastian Redl <sebastian.redl@getdesigned.at> Minor fixups for auto deduction of initializer lists.

Fix some review comments.
Add a test for deduction when std::initializer_list isn't available yet.
Fix redundant error messages. This fixes and outstanding FIXME too.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148735 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p6.cpp
f96241dedab95d633f090191c93250b347b84f53 23-Jan-2012 Douglas Gregor <dgregor@apple.com> Add -Wnarrowing as an alias for -Wc++11-narrowing, for better GCC
compatibility.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148702 91177308-0d34-0410-b5e6-96231b3b80d8
cl.decl/dcl.init/dcl.init.list/p7-cxx11-nowarn.cpp
f3c82c5f5c0321babf054983c29ad84cc90244f7 23-Jan-2012 Douglas Gregor <dgregor@apple.com> Downgrade C++11 narrowing conversion errors to warnings default-mapped
to an error, so that users can turn them off if necessary. Note that
this does *not* change the behavior of in a SFINAE context, where we
still flag an error even if the warning is disabled. This matches
GCC's behavior.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148701 91177308-0d34-0410-b5e6-96231b3b80d8
cl.decl/dcl.init/dcl.init.list/p7-0x.cpp
cl.decl/dcl.init/dcl.init.list/p7-cxx11-nowarn.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/expr.prim/expr.prim.general/p12-0x.cpp
eb96af8a908ea28b2ca76e3848b2476852f592a6 19-Jan-2012 Richard Smith <richard-llvm@metafoo.co.uk> Further testing for instantiation of out-of-line constexpr static data member
template definitions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148506 91177308-0d34-0410-b5e6-96231b3b80d8
lass/class.static/class.static.data/p3.cpp
796c1a1e3e63e459e371383ac878aa5f40b02a8c 19-Jan-2012 Richard Smith <richard-llvm@metafoo.co.uk> An instantiation of a constexpr static data member in a class template is
constexpr.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148505 91177308-0d34-0410-b5e6-96231b3b80d8
lass/class.static/class.static.data/p3.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
asic/basic.types/p10.cpp
xpr/expr.const/p2-0x.cpp
xpr/expr.const/p3-0x.cpp
tmt.stmt/stmt.select/stmt.switch/p2-0x.cpp
4c3fc9b38d3723f73e4ded594cebf38c76f91d93 18-Jan-2012 Richard Smith <richard-llvm@metafoo.co.uk> Move narrowing conversion detection code from SemaInit to SemaOverload, ready
for it to be used in converted constant expression checking, and fix a couple
of issues:
- Conversion operators implicitly invoked prior to the narrowing conversion
were not being correctly handled when determining whether a constant value
was narrowed.
- For conversions from floating-point to integral types, the diagnostic text
incorrectly always claimed that the source expression was not a constant
expression.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148381 91177308-0d34-0410-b5e6-96231b3b80d8
cl.decl/dcl.init/dcl.init.list/p7-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/expr.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/expr.const/p2-0x.cpp
3534050c491454e4a5c7bcd0f8e6054cd89012cd 13-Jan-2012 Richard Smith <richard-llvm@metafoo.co.uk> PR11754: Reject non-static constexpr member functions in classes with virtual
base classes.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148094 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/dcl.spec/dcl.constexpr/p3.cpp
9ec0ef31c3bc40612e8bf47bd7d265d5e7c01ff9 13-Jan-2012 Eli Friedman <eli.friedman@gmail.com> constexpr is allowed on static member functions of non-literal classes. Per report on cfe-dev.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148090 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/dcl.spec/dcl.constexpr/p8.cpp
7984de35644701c0d94336da7f2215d4c26d9f5b 13-Jan-2012 Richard Smith <richard-llvm@metafoo.co.uk> Improve 0-argument -Wvexing-parse diagnostic by adding notes with fix-its:

- If the declarator is at the start of a line, and the previous line contained
another declarator and ended with a comma, then that comma was probably a
typo for a semicolon:

int n = 0, m = 1, l = 2, // k = 5;
myImportantFunctionCall(); // oops!

- If removing the parentheses would correctly initialize the object, then
produce a note suggesting that fix.

- Otherwise, if there is a simple initializer we can suggest which performs
value-initialization, then provide a note suggesting a correction to that
initializer.

Sema::Declarator now tracks the location of the comma prior to the declarator in
the declaration, if there is one, to facilitate providing the note. The code to
determine an appropriate initializer from the -Wuninitialized warning has been
factored out to allow use in both that and -Wvexing-parse.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148072 91177308-0d34-0410-b5e6-96231b3b80d8
asic/basic.link/p9.cpp
cl.dcl/basic.namespace/namespace.udecl/p11.cpp
ec789163a42a7be654ac34aadb750b508954d53c 12-Jan-2012 Richard Smith <richard-llvm@metafoo.co.uk> constexpr: initialization of a union from an empty initializer-list should
zero-initialize the first union member. Also fix a bug where initializing an
array of types compatible with wchar_t from a wide string literal failed in C,
and fortify the C++ tests in this area. This part can't be tested without a code
change to enable array evaluation in C (where an existing test fails).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148035 91177308-0d34-0410-b5e6-96231b3b80d8
cl.decl/dcl.init/dcl.init.string/p1.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/expr.const/p2-0x.cpp
de8facc81f505ca7e86022911145271f614b96ea 11-Jan-2012 Richard Smith <richard-llvm@metafoo.co.uk> constexpr: fix typo resulting in move constructors sometimes not being
implicitly marked constexpr when they should be.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147955 91177308-0d34-0410-b5e6-96231b3b80d8
pecial/class.copy/p13-0x.cpp
bdad7a2e21686296b78dac6190b78d11c996f6d7 10-Jan-2012 Richard Smith <richard-llvm@metafoo.co.uk> Update C++11 scoped enumeration support to match the final proposal:
- reject definitions of enums within friend declarations
- require 'enum', not 'enum class', for non-declaring references to scoped
enumerations


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147824 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/dcl.spec/dcl.type/dcl.type.elab/p3.cpp
d1d512a9cd1923566a52e57b7e1e8ae65392f66b 09-Jan-2012 Nico Weber <nicolasweber@gmx.de> Fix "note" of a duplicate explicit instantiation definition following a specialization.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147798 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.spec/temp.expl.spec/examples.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/expr.const/p2-0x.cpp
2f0e88a87cea6d21429d9f5c0b1c53f24caf77cf 06-Jan-2012 Richard Smith <richard-llvm@metafoo.co.uk> David Blaikie and Chandler would like us to diagnose

int f();

in function scopes under -Wvexing-parse, so now we do.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147649 91177308-0d34-0410-b5e6-96231b3b80d8
asic/basic.link/p9.cpp
cl.dcl/basic.namespace/namespace.udecl/p11.cpp
1d7bcf4b35f8bc0a0a40f4ea7b06b55c63725108 06-Jan-2012 Richard Smith <richard-llvm@metafoo.co.uk> Tweak to r147599 for PR10828: Move the check from the parser into sema, and use
the Semantic Powers to only warn on class types (or dependent types), where the
constructor or destructor could do something interesting.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147642 91177308-0d34-0410-b5e6-96231b3b80d8
asic/basic.link/p9.cpp
cl.dcl/basic.namespace/namespace.udecl/p11.cpp
6aeaa60217e1ed11a621409acf1b53df0d14b591 05-Jan-2012 Eli Friedman <eli.friedman@gmail.com> Tweak the fix to PR8977: an empty expression-list represents value initialization, not default initialization. Fixes PR11712.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147620 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.variadic/p4.cpp
cb7709c06027448c754dd03e2e521d82d04818bf 05-Jan-2012 Richard Smith <richard-llvm@metafoo.co.uk> PR10828: Produce a warning when a no-arguments function is declared in block
scope, when no other indication is provided that the user intended to declare a
function rather than a variable.

Remove some false positives from the existing 'parentheses disambiguated as a
function' warning by suppressing it when the declaration is marked as 'typedef'
or 'extern'.

Add a new warning group -Wvexing-parse containing both of these warnings.

The new warning is enabled by default; despite a number of false positives (and
one bug) in clang's test-suite, I have only found genuine bugs with it when
running it over a significant quantity of real C++ code.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147599 91177308-0d34-0410-b5e6-96231b3b80d8
asic/basic.link/p9.cpp
cl.dcl/basic.namespace/namespace.udecl/p11.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/expr.const/p2-0x.cpp
pecial/class.ctor/p6-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/expr.const/p2-0x.cpp
pecial/class.ctor/p6-0x.cpp
d7c56e1114bfe7d461786903bb720d2c6efc05a1 29-Dec-2011 Richard Smith <richard-llvm@metafoo.co.uk> Change the diagnostics which said 'accepted as an extension' to instead say
'is an extension'. The former is inappropriate and confusing when building with
-Werror/-pedantic-errors.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147357 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.spec/temp.expl.spec/p2.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/expr.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/expr.const/p2-0x.cpp
pecial/class.ctor/p6-0x.cpp
ff91d240d431afbec18e25909caaf5c17f26e643 23-Dec-2011 Nico Weber <nicolasweber@gmx.de> Fix several issues related to specializations and explicit instantiations.

Explicit instantiations following specializations are no-ops and hence have
no PointOfInstantiation. That was done correctly in most cases, but for a
specialization -> instantiation decl -> instantiation definition chain, the
definition didn't realize that it was a no-op. Fix that.

Also, when printing diagnostics for these no-ops, get the diag location from
the decl name location.

Add many test cases, one of them not yet passing (but it failed the same way
before this change). Fixes http://llvm.org/pr11558 and more.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147225 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.spec/temp.expl.spec/examples.cpp
10f04a6267eb07d3be00db1fd0369e1398f5d0a8 22-Dec-2011 Sebastian Redl <sebastian.redl@getdesigned.at> List-initialization via constructor part 1. Still needs: pretty-printing, overloading, initializer_list.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147145 91177308-0d34-0410-b5e6-96231b3b80d8
cl.decl/dcl.init/dcl.init.aggr/p1-0x.cpp
6180245e9f63d2927b185ec251fb75aba30f1cac 22-Dec-2011 Richard Smith <richard-llvm@metafoo.co.uk> PR11614: Mark defaulted special constructors as constexpr if their implicit
definition would satisfy the constexpr requirements.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147128 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/dcl.spec/dcl.constexpr/p1.cpp
cl.dcl/dcl.spec/dcl.constexpr/p3.cpp
cl.decl/dcl.fct.def/dcl.fct.def.default/p2.cpp
pecial/class.copy/p13-0x.cpp
pecial/class.ctor/p6-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
cl.dcl/dcl.spec/dcl.constexpr/p9.cpp
xpr/expr.const/p2-0x.cpp
1d238ea926bbdd04356ce475934fcd4cac654c4b 21-Dec-2011 Richard Smith <richard-llvm@metafoo.co.uk> C++11 half of r147023: In C++11, additionally eagerly instantiate:
- constexpr function template instantiations
- variables of reference type
- constexpr variables


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147031 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/dcl.spec/dcl.constexpr/p1.cpp
c7feca0392f7a55e1efa56fd1579881cd59d03d3 20-Dec-2011 Nico Weber <nicolasweber@gmx.de> Fix a crash on invalid, http://llvm.org/pr11599



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146988 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.spec/temp.explicit/p3.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/expr.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
asic/basic.types/p10.cpp
cl.dcl/dcl.spec/dcl.constexpr/p1.cpp
cl.dcl/dcl.spec/dcl.constexpr/p9.cpp
xpr/expr.const/p2-0x.cpp
fc038e9ef8ed262724f42597ca5c844de97b1202 17-Dec-2011 Eli Friedman <eli.friedman@gmail.com> Remove a non-gcc-compatible extension that would apply attributes on declarations without a declarator to structs. Add a warning for ignored attributes. Patch by Michael Han.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146796 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.variadic/p5.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/expr.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/expr.const/p2-0x.cpp
91ec7894ec186dd36f509682f00486c98d8228ed 16-Dec-2011 David Blaikie <dblaikie@gmail.com> Support decltype in pseudo destructors and dependent destructor calls.

Reviewed by Eli Friedman.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146738 91177308-0d34-0410-b5e6-96231b3b80d8
pecial/class.dtor/p10-0x.cpp
2fe9b7fb07dff15dd15dd8755a9a9e6de0fe46fc 15-Dec-2011 Richard Trieu <rtrieu@google.com> Modify how the -verify flag works. Currently, the verification string and
diagnostic message are compared. If either is a substring of the other, then
no error is given. This gives rise to an unexpected case:

// expect-error{{candidate function has different number of parameters}}

will match the following error messages from Clang:

candidate function has different number of parameters (expected 1 but has 2)
candidate function has different number of parameters

It will also match these other error messages:

candidate function
function has different number of parameters
number of parameters

This patch will change so that the verification string must be a substring of
the diagnostic message before accepting. Also, all the failing tests from this
change have been corrected. Some stats from this cleanup:

87 - removed extra spaces around verification strings
70 - wording updates to diagnostics
40 - extra leading or trailing characters (typos, unmatched parens or quotes)
35 - diagnostic level was included (error:, warning:, or note:)
18 - flag name put in the warning (-Wprotocol)



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146619 91177308-0d34-0410-b5e6-96231b3b80d8
asic/basic.lookup/basic.lookup.argdep/p2.cpp
asic/basic.lookup/basic.lookup.argdep/p4.cpp
asic/basic.lookup/basic.lookup.classref/p1.cpp
asic/basic.start/basic.start.main/p2f.cpp
lass.access/p6.cpp
lass.derived/class.member.lookup/p6.cpp
lass/class.friend/p1.cpp
lass/class.mem/p13.cpp
lass/class.nest/p1-cxx0x.cpp
lass/class.nest/p1.cpp
cl.dcl/basic.namespace/namespace.udecl/p1.cpp
cl.dcl/dcl.spec/dcl.constexpr/p4.cpp
cl.dcl/dcl.spec/dcl.type/p3-0x.cpp
cl.decl/dcl.init/dcl.init.ref/p5-cxx03-extra-copy.cpp
cl.decl/dcl.meaning/dcl.ref/p5.cpp
ver/over.over/p2-resolve-single-template-id.cpp
tmt.stmt/stmt.iter/stmt.ranged/p1.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/expr.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/expr.unary/expr.unary.op/p3.cpp
76178ed0911797175b13ac733c390233f02bb841 14-Dec-2011 David Blaikie <dblaikie@gmail.com> Move & comment the 'decltype in declarator-id' as suggested by Doug Gregor.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146576 91177308-0d34-0410-b5e6-96231b3b80d8
cl.decl/dcl.meaning/p1-0x.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
cl.decl/dcl.meaning/p1-0x.cpp
xpr/expr.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/expr.const/p2-0x.cpp
4db8c4483ea7b271bcce3a0312a0ac434313c09b 12-Dec-2011 David Blaikie <dblaikie@gmail.com> Fix/test decltype dtor calls with invalid base expression.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146354 91177308-0d34-0410-b5e6-96231b3b80d8
pecial/class.dtor/p10-0x.cpp
2def77399ab3088106a2d61372344f5b7104e1a2 09-Dec-2011 David Blaikie <dblaikie@gmail.com> Add notes for suppressing and (if it's a zero-arg function returning bool) fixing the function-to-bool conversion warning.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146280 91177308-0d34-0410-b5e6-96231b3b80d8
ver/over.over/p2-resolve-single-template-id.cpp
53a75c07dbe79b3dd5dd88a0378aefa18f793083 08-Dec-2011 David Blaikie <dblaikie@gmail.com> Decltype in non-pseudo (& non-dependent) dtor calls.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146155 91177308-0d34-0410-b5e6-96231b3b80d8
pecial/class.dtor/p10-0x.cpp
e14ca9f509dc22d8fcc5d21d70d28a5848983b42 05-Dec-2011 Lang Hames <lhames@gmail.com> Add a warning for implicit conversion from function literals (and static
methods) to bool. E.g.

void foo() {}
if (f) { ... // <- Warns here.
}

Only applies to non-weak functions, and does not apply if the function address
is taken explicitly with the addr-of operator.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145849 91177308-0d34-0410-b5e6-96231b3b80d8
ver/over.over/p2-resolve-single-template-id.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/expr.prim/expr.prim.general/p4-0x.cpp
xpr/expr.prim/expr.prim.general/p8-0x.cpp
f48538897ccd6726e87485267495a62fdfd0b369 28-Nov-2011 Douglas Gregor <dgregor@apple.com> When synthesizing an implicitly-defined copy or move constructor, or
when computing the exception specification of a copy or move constructor,
ignore non-static data member initializers. Fixes PR11418 /
<rdar://problem/10478642>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145269 91177308-0d34-0410-b5e6-96231b3b80d8
pecial/class.copy/p15-0x.cpp
pecial/class.copy/p15-inclass.cpp
6fe2965ce722826ae7c3af85271f900286ef20c3 17-Nov-2011 David Blaikie <dblaikie@gmail.com> Include named unions in union member init checking

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144883 91177308-0d34-0410-b5e6-96231b3b80d8
lass/class.base/class.base.init/p5-0x.cpp
pecial/class.init/class.base.init/p8-0x.cpp
3bc451593fa44bfc45753e44e37cb4242e714f82 15-Nov-2011 Eli Friedman <eli.friedman@gmail.com> Compute whether a class is trivial correctly for template classes with an explicitly deleted or defaulted special member. PR11387.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144715 91177308-0d34-0410-b5e6-96231b3b80d8
pecial/class.ctor/p5-0x.cpp
32509f1e60451d86e9fbc473b6e853ba10b5fd1e 15-Nov-2011 John McCall <rjmccall@apple.com> Resolve placeholder expressions before trying to deduce
'auto'. Introduce a convenience method to make this a bit
easier, and use it elsewhere.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144605 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p6.cpp
1bf9a9e6a5bdc0de7939908855dcddf46b661800 12-Nov-2011 Richard Smith <richard-llvm@metafoo.co.uk> Represent an APValue based on a Decl as that Decl, rather than a DeclRefExpr
or MemberExpr which refers to it. As a side-effect, MemberExprs which refer to
static member functions and static data members are now emitted as constant
expressions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144468 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/dcl.spec/dcl.constexpr/p8.cpp
180f47959a066795cc0f409433023af448bb0328 10-Nov-2011 Richard Smith <richard-llvm@metafoo.co.uk> Constant expression evaluation: support for evaluation of structs and unions of
literal types, as well as derived-to-base casts for lvalues and
derived-to-virtual-base casts.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144265 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/dcl.spec/dcl.constexpr/p1.cpp
aa9aa3bfcd843caf2612726aa9115b30e7006348 08-Nov-2011 Richard Smith <richard-llvm@metafoo.co.uk> Some tests missed from r144056.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144060 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.res/temp.dep/temp.dep.constexpr/p2-0x.cpp
emp/temp.res/temp.dep/temp.dep.constexpr/p2.cpp
66f85713bd0d22f867efa8e9fb0037befdd6b151 07-Nov-2011 Richard Smith <richard-llvm@metafoo.co.uk> constexpr: static data members declared constexpr are required to have an
initializer; all other constexpr variables are merely required to be
initialized. In particular, a user-provided constexpr default constructor can be
used for such initialization.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144028 91177308-0d34-0410-b5e6-96231b3b80d8
lass/class.static/class.static.data/p3.cpp
cl.dcl/dcl.spec/dcl.constexpr/p1.cpp
cl.dcl/dcl.spec/dcl.constexpr/p9.cpp
45fa560c72441069d9e4eb1e66efd87349caa552 07-Nov-2011 Douglas Gregor <dgregor@apple.com> When we notice that a member function is defined with "= delete" or "=
default", make a note of which is used when creating the
initial declaration. Previously, we would wait until later to handle
default/delete as a definition, but this is too late: when adding the
declaration, we already treated the declaration as "user-provided"
when in fact it was merely "user-declared".

Fixes PR10861 and PR10442, along with a bunch of FIXMEs.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144011 91177308-0d34-0410-b5e6-96231b3b80d8
asic/basic.types/p10.cpp
lass/p6-0x.cpp
cl.decl/dcl.init/dcl.init.aggr/p1-0x.cpp
pecial/class.ctor/p5-0x.cpp
pecial/class.temporary/p1.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/expr.prim/expr.prim.general/p12-0x.cpp
xpr/expr.prim/expr.prim.general/p4-0x.cpp
xpr/expr.prim/p12-0x.cpp
xpr/expr.prim/p4-0x.cpp
d9f5b3363bc0edc314f0136cd66b22e545344fa5 01-Nov-2011 Eli Friedman <eli.friedman@gmail.com> Make test work with ARM C++ ABI.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143425 91177308-0d34-0410-b5e6-96231b3b80d8
pecial/class.copy/implicit-move-def.cpp
839046a8c5f890f172b0a172ed6ec9e7d0275f2e 29-Oct-2011 Richard Smith <richard-llvm@metafoo.co.uk> Add test missed from r143234.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143257 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/dcl.spec/dcl.constexpr/p5.cpp
3bfb571bd4af9303781c40306a06bf70fe51fa75 26-Oct-2011 Eli Friedman <eli.friedman@gmail.com> Compute the promoted integer type of fixed-width enums correctly. Found by inspection.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143021 91177308-0d34-0410-b5e6-96231b3b80d8
onv/conv.prom/p4.cpp
68a2dc446fe6d32d5da3557902100ed06b21b12b 26-Oct-2011 Eli Friedman <eli.friedman@gmail.com> Correctly perform integral promotions on wchar_t/char16_t/char32_t in C++. <rdar://problem/10309088>.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143019 91177308-0d34-0410-b5e6-96231b3b80d8
onv/conv.prom/p2.cpp
7fe3878a36750515fb9772414ecb2489cf149d19 25-Oct-2011 David Blaikie <dblaikie@gmail.com> Handle redundant 'typename' on base class specifications.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142937 91177308-0d34-0410-b5e6-96231b3b80d8
lass.derived/p1.cpp
152aa4b87633754801598ee282e1a17c3ec49257 25-Oct-2011 David Blaikie <dblaikie@gmail.com> Fix erroneous name-specifiers prior to decltypes better/correctly as per Doug's feedback.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142935 91177308-0d34-0410-b5e6-96231b3b80d8
lass.derived/p1.cpp
22216eb4fb0936d2488fc03abd285d135c36ff01 25-Oct-2011 David Blaikie <dblaikie@gmail.com> Fix cases where the optional nested-name-specifier erroneously preceeded a decltype-specification when specifying a base type.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142928 91177308-0d34-0410-b5e6-96231b3b80d8
lass.derived/p1.cpp
09048df0b3f472091b2204e531d6b6019244884b 25-Oct-2011 David Blaikie <dblaikie@gmail.com> Support the use of decltype for specifying base types. Fixes PR11216.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142926 91177308-0d34-0410-b5e6-96231b3b80d8
lass.derived/p1.cpp
5c27ee0c9499fa6a2ee728cb8ca4311a1f2ab675 25-Oct-2011 Douglas Gregor <dgregor@apple.com> Undo unnecessary change

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142907 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p3.cpp
c2c11446caaee2d5a787cc8d0310330c6364210d 25-Oct-2011 Douglas Gregor <dgregor@apple.com> Make the -Wc++11-compat warnings ignored by default, so we don't break
valid C++98/03 code. However, add these warnings to -Wall, for those
who obviously already like clean code.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142903 91177308-0d34-0410-b5e6-96231b3b80d8
lass/class.friend/p6.cpp
cl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p3.cpp
emp/temp.spec/temp.explicit/p2.cpp
emp/temp.spec/temp.explicit/p3.cpp
emp/temp.spec/temp.explicit/p5.cpp
0b64ba926752110cff1344a46b36e29396cc4d25 23-Oct-2011 Peter Collingbourne <peter@pcc.me.uk> Fix grammar for C++11 alignment specifiers, and add a few FIXMEs.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142760 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.variadic/p5.cpp
fef2189421b89dad5582b6dd7561badd4224d974 23-Oct-2011 Peter Collingbourne <peter@pcc.me.uk> Diagnose unexpanded parameter packs in member initialisers (including
in-class member initialisers).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142758 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.variadic/p5.cpp
0661bd0ccae381613c5967cdf2514255e1f92636 23-Oct-2011 Peter Collingbourne <peter@pcc.me.uk> Attach class template attributes to the templated CXXRecordDecl,
instead of silently discarding them.

As a side effect, this improves diagnostics for constexpr class
templates slightly.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142755 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/dcl.spec/dcl.constexpr/p1.cpp
7a8a2e3c7ff283bc98b5292b6a579d4fca63e36b 21-Oct-2011 Peter Collingbourne <peter@pcc.me.uk> Permit auto SCS on parameter declarations, C++03 [dcl.stc]p2

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142649 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/dcl.spec/dcl.stc/p2.cpp
0e9e9814a7f8313c0c02b6afea71f0e4c411873e 20-Oct-2011 Richard Smith <richard-llvm@metafoo.co.uk> Add -Wc++98-compat diagnostics for jumps which bypass initialization of non-POD
but trivially constructible and destructible variables in C++11 mode. Also
incidentally improve the precision of the wording for jump diagnostics in C++98
mode.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142619 91177308-0d34-0410-b5e6-96231b3b80d8
tmt.stmt/stmt.dcl/p3.cpp
9324583ad2afd09db8c9967cd05c4fa44bac9555 20-Oct-2011 Richard Smith <richard-llvm@metafoo.co.uk> 'extern template' is a C++11 feature. Add an Extension for C++98 (this matches
gcc's behaviour), and a -Wc++98-compat-pedantic warning for C++11.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142597 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.spec/temp.explicit/p4.cpp
1368e58ae0eb3d92df9fa5538349b6adf6448d15 19-Oct-2011 David Blaikie <dblaikie@gmail.com> Fix pr9789, assert-on-invalid while instantiating an (invalid) class template with a non-final parameter pack. Also improve the warning for non-final parameter packs in this scenario so it only fires once, rather than once for every template parameter after the non-final parameter pack.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142473 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.param/p11-0x.cpp
dd67723af339f94870149ee1934dd652f83ca738 18-Oct-2011 Richard Smith <richard-llvm@metafoo.co.uk> Simplify RecordDeclCXX::setBases slightly. No functional change.

Add test that a variadic base list which expands to 0 bases doesn't make the
class a non-aggregate. This test passed before the change, too.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142411 91177308-0d34-0410-b5e6-96231b3b80d8
cl.decl/dcl.init/dcl.init.aggr/p1-0x.cpp
f106f0ee3ba0c81d4c56f7935f518da53d78c08e 18-Oct-2011 Richard Smith <richard-llvm@metafoo.co.uk> In C++11, a class's members are allowed to be nominated as friends.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142393 91177308-0d34-0410-b5e6-96231b3b80d8
lass/class.friend/p1-cxx11.cpp
5f31f0893d75203c326ddcd9808099bbfe34aec0 18-Oct-2011 David Blaikie <dblaikie@gmail.com> Switch to the C++11 warning flags in tests.
Patch by Ahmed Charles!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142340 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p3.cpp
cl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p4.cpp
cl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p6.cpp
cl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p7.cpp
cl.decl/dcl.init/dcl.init.list/p7-0x-fixits.cpp
cl.decl/dcl.init/dcl.init.ref/p5-0x.cpp
5acb0c98b363400f6ade0ae7250f0102224e806b 17-Oct-2011 John McCall <rjmccall@apple.com> Teach the ARC compiler to not require __bridge casts when
passing/receiving CF objects at +0 to/from Objective-C methods
or audited C functions.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142219 91177308-0d34-0410-b5e6-96231b3b80d8
ver/over.over/p2-resolve-single-template-id.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/expr.post/expr.call/p7-0x.cpp
fe6f64846b8714b2951d9ea80fc40a3e020f3920 14-Oct-2011 Richard Smith <richard-llvm@metafoo.co.uk> [temp.explicit]p1: constexpr cannot be specified in explicit instantiations.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141982 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.spec/temp.explicit/p1-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
asic/basic.lookup/basic.lookup.qual/p6-0x.cpp
asic/basic.scope/basic.scope.local/p4-0x.cpp
asic/basic.scope/basic.scope.pdecl/p3.cpp
asic/basic.types/p10.cpp
lass.access/class.friend/p3-cxx0x.cpp
lass.derived/class.virtual/p3-0x.cpp
lass/class.bit/p2.cpp
lass/class.mem/p5-0x.cpp
lass/class.mem/p8-0x.cpp
lass/class.nest/p1-cxx0x.cpp
lass/class.static/class.static.data/p3.cpp
lass/p1-0x.cpp
lass/p2-0x.cpp
lass/p6-0x.cpp
cl.dcl/basic.namespace/namespace.def/p7.cpp
cl.dcl/basic.namespace/namespace.def/p8.cpp
cl.dcl/basic.namespace/namespace.udecl/p3-cxx0x.cpp
cl.dcl/dcl.spec/dcl.constexpr/p1.cpp
cl.dcl/dcl.spec/dcl.constexpr/p2.cpp
cl.dcl/dcl.spec/dcl.constexpr/p3.cpp
cl.dcl/dcl.spec/dcl.constexpr/p4.cpp
cl.dcl/dcl.spec/dcl.constexpr/p6.cpp
cl.dcl/dcl.spec/dcl.constexpr/p8.cpp
cl.dcl/dcl.spec/dcl.constexpr/p9.cpp
cl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p2.cpp
cl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p3.cpp
cl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p4.cpp
cl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p5.cpp
cl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p6.cpp
cl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p7.cpp
cl.dcl/dcl.spec/dcl.type/dcl.type.elab/p2-0x.cpp
cl.dcl/dcl.spec/dcl.type/dcl.type.simple/p4-cxx0x.cpp
cl.dcl/dcl.spec/dcl.type/p3-0x.cpp
cl.dcl/dcl.spec/dcl.typedef/p2-0x.cpp
cl.decl/dcl.init/dcl.init.aggr/p1-0x.cpp
cl.decl/dcl.init/dcl.init.list/p7-0x.cpp
cl.decl/dcl.init/dcl.init.ref/p1.cpp
cl.decl/dcl.init/dcl.init.ref/p5-0x.cpp
cl.decl/dcl.init/dcl.init.ref/p5-cxx0x-no-extra-copy.cpp
cl.decl/dcl.init/p14-0x.cpp
cl.decl/dcl.meaning/dcl.array/p1-cxx0x.cpp
cl.decl/dcl.meaning/dcl.fct/dcl.fct.def.default/p2.cpp
cl.decl/dcl.meaning/dcl.fct/p13.cpp
cl.decl/dcl.meaning/dcl.fct/p14.cpp
cl.decl/dcl.meaning/dcl.fct/p2-cxx0x.cpp
cl.decl/dcl.meaning/dcl.fct/p6-0x.cpp
cl.decl/dcl.meaning/dcl.fct/p8-0x.cpp
cl.decl/dcl.meaning/dcl.fct/p9-0x.cpp
cl.decl/dcl.meaning/dcl.ref/p6-0x.cpp
cl.decl/p4-0x.cpp
xcept/except.spec/canonical.cpp
xcept/except.spec/p1.cpp
xcept/except.spec/p11.cpp
xcept/except.spec/p14.cpp
xcept/except.spec/p15.cpp
xcept/except.spec/p2-places.cpp
xcept/except.spec/p3.cpp
xcept/except.spec/p5-pointers.cpp
xcept/except.spec/p5-virtual.cpp
xcept/except.spec/p9-noexcept.cpp
xcept/except.spec/template.cpp
xpr/expr.cast/p4-0x.cpp
xpr/expr.const/p2-0x.cpp
xpr/expr.mptr.oper/p6-0x.cpp
xpr/expr.post/expr.call/p7-0x.cpp
xpr/expr.post/expr.const.cast/p1-0x.cpp
xpr/expr.post/expr.dynamic.cast/p3-0x.cpp
xpr/expr.post/expr.reinterpret.cast/p1-0x.cpp
xpr/expr.post/expr.static.cast/p3-0x.cpp
xpr/expr.post/expr.static.cast/p9-0x.cpp
xpr/expr.prim/p12-0x.cpp
xpr/expr.prim/p4-0x.cpp
xpr/expr.unary/expr.new/p2-cxx0x.cpp
xpr/expr.unary/expr.new/p20-0x.cpp
xpr/expr.unary/expr.sizeof/p5-0x.cpp
xpr/expr.unary/expr.unary.noexcept/cg.cpp
xpr/expr.unary/expr.unary.noexcept/sema.cpp
ex/lex.literal/lex.ccon/p1.cpp
ex/lex.literal/lex.ext/p1.cpp
ex/lex.pptoken/p3-0x.cpp
ver/over.built/p23.cpp
ver/over.built/p25.cpp
ver/over.load/p2-0x.cpp
ver/over.match/over.match.best/over.best.ics/over.ics.user/p3-0x.cpp
ver/over.match/over.match.best/over.ics.rank/p3-0x.cpp
ver/over.match/over.match.funcs/p4-0x.cpp
pecial/class.copy/implicit-move-def.cpp
pecial/class.copy/implicit-move.cpp
pecial/class.copy/p11.0x.copy.cpp
pecial/class.copy/p11.0x.move.cpp
pecial/class.copy/p15-0x.cpp
pecial/class.copy/p33-0x.cpp
pecial/class.ctor/p4-0x.cpp
pecial/class.ctor/p5-0x.cpp
pecial/class.dtor/p2-0x.cpp
pecial/class.dtor/p3-0x.cpp
pecial/class.inhctor/elsewhere.cpp
pecial/class.inhctor/p3.cpp
pecial/class.inhctor/p7.cpp
pecial/class.init/class.base.init/p8-0x.cpp
pecial/class.init/class.base.init/p9-0x.cpp
pecial/class.temporary/p1.cpp
tmt.stmt/stmt.dcl/p3-0x.cpp
tmt.stmt/stmt.iter/stmt.ranged/p1.cpp
emp/temp.arg/temp.arg.template/p3-0x.cpp
emp/temp.arg/temp.arg.type/p2-cxx0x.cpp
emp/temp.decls/p3.cpp
emp/temp.decls/temp.alias/p1.cpp
emp/temp.decls/temp.alias/p2.cpp
emp/temp.decls/temp.alias/p3.cpp
emp/temp.decls/temp.class.spec/p8-0x.cpp
emp/temp.decls/temp.class.spec/p9-0x.cpp
emp/temp.decls/temp.fct/temp.func.order/p3-0x.cpp
emp/temp.decls/temp.variadic/deduction.cpp
emp/temp.decls/temp.variadic/example-bind.cpp
emp/temp.decls/temp.variadic/example-function.cpp
emp/temp.decls/temp.variadic/example-tuple.cpp
emp/temp.decls/temp.variadic/ext-blocks.cpp
emp/temp.decls/temp.variadic/injected-class-name.cpp
emp/temp.decls/temp.variadic/metafunctions.cpp
emp/temp.decls/temp.variadic/multi-level-substitution.cpp
emp/temp.decls/temp.variadic/p1.cpp
emp/temp.decls/temp.variadic/p2.cpp
emp/temp.decls/temp.variadic/p4.cpp
emp/temp.decls/temp.variadic/p5.cpp
emp/temp.decls/temp.variadic/parameter-matching.cpp
emp/temp.decls/temp.variadic/partial-ordering.cpp
emp/temp.fct.spec/temp.arg.explicit/p3-0x.cpp
emp/temp.fct.spec/temp.arg.explicit/p9-0x.cpp
emp/temp.fct.spec/temp.deduct/cwg1170.cpp
emp/temp.fct.spec/temp.deduct/temp.deduct.call/p1-0x.cpp
emp/temp.fct.spec/temp.deduct/temp.deduct.call/p3-0x.cpp
emp/temp.fct.spec/temp.deduct/temp.deduct.partial/p12.cpp
emp/temp.fct.spec/temp.deduct/temp.deduct.partial/p9-0x.cpp
emp/temp.fct.spec/temp.deduct/temp.deduct.type/p10-0x.cpp
emp/temp.fct.spec/temp.deduct/temp.deduct.type/p2-0x.cpp
emp/temp.fct.spec/temp.deduct/temp.deduct.type/p21.cpp
emp/temp.fct.spec/temp.deduct/temp.deduct.type/p22.cpp
emp/temp.fct.spec/temp.deduct/temp.deduct.type/p5-0x.cpp
emp/temp.fct.spec/temp.deduct/temp.deduct.type/p8-0x.cpp
emp/temp.fct.spec/temp.deduct/temp.deduct.type/p9-0x.cpp
emp/temp.param/p10-0x.cpp
emp/temp.param/p11-0x.cpp
emp/temp.param/p15-cxx0x.cpp
emp/temp.param/p9-0x.cpp
emp/temp.res/temp.dep/temp.dep.type/p1.cpp
emp/temp.spec/temp.expl.spec/p2-0x.cpp
emp/temp.spec/temp.explicit/p1-0x.cpp
emp/temp.spec/temp.explicit/p3-0x.cpp
emp/temp.spec/temp.explicit/p9-linkage.cpp
emp/temp.spec/temp.explicit/p9.cpp
emp/temp.type/p1-0x.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/expr.unary/expr.unary.op/p6.cpp
5fad9b8362c62e230f6603d86ec7d1747e74c737 12-Oct-2011 Douglas Gregor <dgregor@apple.com> When we determine that a function template specialization produced as
part of template argument deduction is ill-formed, we mark it as
invalid and treat it as a deduction failure. If we happen to find that
specialization again, treat it as a deduction failure rather than
silently building a call to the declaration.

Fixes PR11117, a marvelous bug where deduction failed after creating
an invalid specialization, causing overload resolution to pick a
different candidate. Then we performed a similar overload resolution
later, and happily picked the invalid specialization to
call... resulting in a silent link failure.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141809 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.mem/p5.cpp
b3df1386680b3830d2f4d300d4d7eaba134135fc 12-Oct-2011 Douglas Gregor <dgregor@apple.com> Switch diagnostic text from "C++0x" over to "C++11".

We'd also like for "C++11" or "c++11" to be used for the warning
groups, but without removing the old warning flags. Patches welcome;
I've run out of time to work on this today.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141801 91177308-0d34-0410-b5e6-96231b3b80d8
lass.access/class.friend/p2-cxx03.cpp
lass/class.friend/p2.cpp
lass/class.friend/p6.cpp
cl.dcl/dcl.spec/dcl.fct.spec/p6.cpp
emp/temp.param/p15.cpp
emp/temp.param/p9.cpp
5fa6a0422f12216d549d0f2991a29d5690634065 12-Oct-2011 Richard Smith <richard-llvm@metafoo.co.uk> constexpr: don't consider class types with mutable members to be literal types.

The standard doesn't allow this, but mutable constexpr variables break the
semantics so badly that we can't reasonably accept them.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141768 91177308-0d34-0410-b5e6-96231b3b80d8
asic/basic.types/p10.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/expr.unary/expr.unary.op/p6.cpp
ver/over.over/p2-resolve-single-template-id.cpp
emp/temp.fct.spec/temp.arg.explicit/p3-nodeduct.cpp
769bb2d0dbd173589747cc8e7428a66db3b2692e 11-Oct-2011 Sean Hunt <scshunt@csclub.uwaterloo.ca> Get rid of ShouldDeleteMoveConstructor.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141650 91177308-0d34-0410-b5e6-96231b3b80d8
pecial/class.copy/p11.0x.move.cpp
c32d684d6c787b332a64c9013598d5ef668c4b45 11-Oct-2011 Sean Hunt <scshunt@csclub.uwaterloo.ca> Consolidate copy constructor deletion into ShouldDeleteSpecialMember.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141645 91177308-0d34-0410-b5e6-96231b3b80d8
pecial/class.copy/p11.0x.copy.cpp
089e8939b7b3e72c32477e39df82f18e6a8f436e 10-Oct-2011 Douglas Gregor <dgregor@apple.com> When substituting into a sizeof parameter pack expression in a context
where we can't expand (i.e., multi-level substitution), be sure to
substitute the pack with its level-reduced pack. Fixes PR10230.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141568 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.variadic/multi-level-substitution.cpp
d61db33331c264d6361283602b248a7423040597 10-Oct-2011 Douglas Gregor <dgregor@apple.com> Per C++ [class.bit]p2, unnamed bit-fields are not members. Fixes PR10289.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141549 91177308-0d34-0410-b5e6-96231b3b80d8
lass/class.bit/p2.cpp
6e4337556efa700d5b4dceac22fa0dfbd1cdee8f 10-Oct-2011 Richard Smith <richard-llvm@metafoo.co.uk> constexpr: Disable checking of constructor member initializer lists for
constexpr constructor templates. Such checking is optional, and currently hard
to get right since clang doesn't generate implicit member initializers until
instantiation (even for non-dependent members).

This is needed for clang to accept libstdc++ from g++4.6 in c++0x mode.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141547 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/dcl.spec/dcl.constexpr/p4.cpp
d24c306e693a1013b233f062291e87d49fa8a580 10-Oct-2011 Douglas Gregor <dgregor@apple.com> When adding a direct initializer to a declaration, allow the
initializer to update the type of the declaration. For example, this
allows us to determine the size of an incomplete array from its
initializer. Fixes PR10288.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141543 91177308-0d34-0410-b5e6-96231b3b80d8
cl.decl/dcl.init/dcl.init.string/p1.cpp
25aaff9cf8a66bc236e5ccaf6183d11c14674cd3 10-Oct-2011 Douglas Gregor <dgregor@apple.com> Always add the built-in overload candidates for operators &&, ||, and
!. Fixes PR9865.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141537 91177308-0d34-0410-b5e6-96231b3b80d8
ver/over.built/p23.cpp
e16da07474c376fbbeda2d4238cf35e2bd664d5a 10-Oct-2011 Sean Hunt <scshunt@csclub.uwaterloo.ca> Begin work consolidating ShouldDelete* functions.

Begin with just default constructors. One note is that as a side effect
of this, a conformance test was removed on the basis that this is almost
certainly a defect as with most of union initialization. As it is, clang
does not implement union initialization close to the standard as it's
quite broken as written. I hope to write a paper addressing the issues
eventually.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141528 91177308-0d34-0410-b5e6-96231b3b80d8
pecial/class.ctor/p5-0x.cpp
883af83bd6f9b0b60b8c7a78b8682eb8ab40a4a8 10-Oct-2011 Douglas Gregor <dgregor@apple.com> Implement the restrictions in C++ [class.friend]p6, which disallow
defining a friend function with a qualified name or in a local
class. Fixes PR9853.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141524 91177308-0d34-0410-b5e6-96231b3b80d8
lass.access/class.friend/p6.cpp
ac57f0b9097e04f70a631549383a2944f74ad844 10-Oct-2011 Douglas Gregor <dgregor@apple.com> The effective context of a friend function is its lexical
context. Fixes PR9103.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141520 91177308-0d34-0410-b5e6-96231b3b80d8
lass.access/class.friend/p1.cpp
lass.access/class.protected/p1.cpp
d8f5b333f96b4e8018ff3a0d0db62d9e78eb6bdd 10-Oct-2011 Douglas Gregor <dgregor@apple.com> Per the note in C++0x [temp.deduct.call]p4, don't attempt template
argument deduction against a function parameter that has no deducible
template parameters in it. Fixes PR8598.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141517 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.fct.spec/temp.deduct/temp.deduct.call/p4.cpp
33ab0da4b50c0868f0dbbbbb8d018b44acd2bd4d 09-Oct-2011 Douglas Gregor <dgregor@apple.com> A friend template specialization is also dependent if any of its
template arguments are dependent. Fixes PR10913.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141515 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.friend/p1.cpp
b5a0187b12524d2c1e6ac96e81715d1e70bbe0ad 09-Oct-2011 Douglas Gregor <dgregor@apple.com> Diagnose attempts to declare a non-static data member with a
non-identifier name. Fixes PR10839.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141513 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/dcl.spec/dcl.type/p3-0x.cpp
5c340e803ed2e384ff47f3e560df253515c92e1e 09-Oct-2011 Douglas Gregor <dgregor@apple.com> After instantiating a 'noexcept' expression, be sure to convert it to
a boolean value and check that it is a constant expression. Fixes
PR11084.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141511 91177308-0d34-0410-b5e6-96231b3b80d8
xcept/except.spec/p1.cpp
b52c0dddffdb27b3a058913020001afcfc937d8d 06-Oct-2011 Richard Smith <richard-llvm@metafoo.co.uk> PR11067: A definition of a constexpr static variable doesn't need an initializer if the in-class declaration had one. Such a declaration must be initialized by a constant expression.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141279 91177308-0d34-0410-b5e6-96231b3b80d8
lass/class.static/class.static.data/p3.cpp
203050c2d5413c3f7e18dfa39451bf6f954136ca 05-Oct-2011 Douglas Gregor <dgregor@apple.com> Don't allow an rvalue reference to bind to the result of a calling a
conversion function whose result type is an lvalue reference. The
initialization code already handled this properly, but overload
resolution was allowing the binding. Fixes PR11003 /
<rdar://problem/10233078>.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141137 91177308-0d34-0410-b5e6-96231b3b80d8
cl.decl/dcl.init/dcl.init.ref/p5-0x.cpp
9f569cca2a4c5fb6026005434e27025b9e71309d 01-Oct-2011 Richard Smith <richard-llvm@metafoo.co.uk> constexpr: semantic checking for constexpr functions and constructors. Based in
part on patches by Peter Collingbourne.

We diverge from the C++11 standard in a few areas, mostly related to checking
constexpr function declarations, and not just definitions. See WG21 paper
N3308=11-0078 for details.

Function invocation substitution is not available in this patch; constexpr
functions cannot yet be used from within constant expressions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140926 91177308-0d34-0410-b5e6-96231b3b80d8
asic/basic.types/p10.cpp
cl.dcl/dcl.spec/dcl.constexpr/p1.cpp
cl.dcl/dcl.spec/dcl.constexpr/p3.cpp
cl.dcl/dcl.spec/dcl.constexpr/p4.cpp
cl.dcl/dcl.spec/dcl.constexpr/p6.cpp
cl.dcl/dcl.spec/dcl.constexpr/p8.cpp
55dec868977ccb89cab0286122f9345f63bb5de7 30-Sep-2011 Richard Smith <richard-llvm@metafoo.co.uk> constexpr functions are implicitly const. More tests to follow.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140831 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/dcl.spec/dcl.constexpr/p2.cpp
cl.decl/dcl.meaning/dcl.fct/dcl.fct.def.default/p2.cpp
2d23ec29805f54edb3243022c64d752b8fbe5f46 30-Sep-2011 Richard Smith <richard-llvm@metafoo.co.uk> Suggest adding 'constexpr' if the GNU extension for in-class initializers for static const float members is used in C++11 mode.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140828 91177308-0d34-0410-b5e6-96231b3b80d8
lass/class.static/class.static.data/p3.cpp
947be1941e9a1d4233116f51a45799d3904d4231 30-Sep-2011 Richard Smith <richard-llvm@metafoo.co.uk> Mark the ExtWarn for in-class initialization of static const float members as a GNU extension. Don't extend the scope of this extension to all literal types in C++0x mode.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140820 91177308-0d34-0410-b5e6-96231b3b80d8
lass/class.static/class.static.data/p3.cpp
c6d990a767150b02337de1136fdb55ccf349f4d1 29-Sep-2011 Richard Smith <richard-llvm@metafoo.co.uk> constexpr: semantic checking for constexpr variables.

We had an extension which allowed const static class members of floating-point type to have in-class initializers, 'as a C++0x extension'. However, C++0x does not allow this. The extension has been kept, and extended to all literal types in C++0x mode (with a fixit to add the 'constexpr' specifier).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140801 91177308-0d34-0410-b5e6-96231b3b80d8
lass/class.static/class.static.data/p3.cpp
cl.dcl/dcl.spec/dcl.constexpr/p1.cpp
cl.dcl/dcl.spec/dcl.constexpr/p9.cpp
tmt.stmt/stmt.iter/stmt.ranged/p1.cpp
82d0b0aab9088e977c2a44c4a5a90479c63149fe 29-Sep-2011 Peter Collingbourne <peter@pcc.me.uk> Add support for alignment-specifiers in C1X and C++11, remove
support for the C++0x draft [[align]] attribute and add the C1X
standard header file stdalign.h

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140796 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/dcl.spec/dcl.type/p3-0x.cpp
be1aa410274b28fc143c47c814f07c989f4534d6 29-Sep-2011 Daniel Dunbar <daniel@zuster.org> Basic/Diagnostics: Rewrite DiagnosticIDs::getDiagnosticLevel completely to be straighter line code, use the new DiagnosticMappingInfo flags, and eliminate the odd MAP_WARNING_NO_WERROR and friend mappings.
- This fixes a host of obscure bugs with regards to how warning mapping options composed with one another, and I believe makes the code substantially easier to read and reason about.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140770 91177308-0d34-0410-b5e6-96231b3b80d8
cl.decl/dcl.init/dcl.init.aggr/p4.cpp
af130823cbac5c02f7fe57a5733ee511f5a3ac98 22-Sep-2011 Douglas Gregor <dgregor@apple.com> Don't allow template argument deduction to deduce a placeholder type,
ever. Fixes PR10939.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140304 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p6.cpp
ca82a82082edc982a1fb5fcfef2dd2c8cf9bc824 21-Sep-2011 John McCall <rjmccall@apple.com> Enforce access control for conversion operators used in contextual
conversions (rather than just call-arguments).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140244 91177308-0d34-0410-b5e6-96231b3b80d8
lass.access/p6.cpp
285cfd8953d4ca4da613a47a0d691f7234068f8c 19-Sep-2011 Bill Wendling <isanbard@gmail.com> Throw the switch to convert clang to the new exception handling model!

This model uses the 'landingpad' instruction, which is pinned to the top of the
landing pad. (A landing pad is defined as the destination of the unwind branch
of an invoke instruction.) All of the information needed to generate the correct
exception handling metadata during code generation is encoded into the
landingpad instruction.

The new 'resume' instruction takes the place of the llvm.eh.resume intrinsic
call. It's lowered in much the same way as the intrinsic is.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140049 91177308-0d34-0410-b5e6-96231b3b80d8
xcept/except.spec/p9-dynamic.cpp
xcept/except.spec/p9-noexcept.cpp
a495066d3cc094b3eb5edb4efbdb169da1f67841 19-Sep-2011 Richard Smith <richard-llvm@metafoo.co.uk> In constructors, don't generate implicit initializers for members of anonymous structs contained within anonymous unions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140015 91177308-0d34-0410-b5e6-96231b3b80d8
pecial/class.init/class.base.init/p8-0x.cpp
c115f630b748b2f27cff34137fb6a50b10a471a5 18-Sep-2011 Richard Smith <richard-llvm@metafoo.co.uk> PR10954: variant members should not be implicitly initialized in constructors if no
mem-initializer is specified for them, unless an in-class initializer is specified.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139996 91177308-0d34-0410-b5e6-96231b3b80d8
pecial/class.init/class.base.init/p8-0x.cpp
b2b5658a8e4ad566303ec98caceaa3485e7635f7 06-Sep-2011 Douglas Gregor <dgregor@apple.com> When performing a derived-to-base cast on the right-hand side of the
synthesized move assignment within an implicitly-defined move
assignment operator, be sure to treat the derived-to-base cast as an
xvalue (rather than an lvalue). Otherwise, we'll end up getting the
wrong constructor.

Optimize a direct call to a trivial move assignment operator to an
aggregate copy, as we do for trivial copy assignment operators, and
update the the assertion in CodeGenFunction::EmitAggregateCopy() to
cope with this optimization.

Fixes PR10860.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139143 91177308-0d34-0410-b5e6-96231b3b80d8
pecial/class.copy/implicit-move-def.cpp
017ab77655b262311a3550342ca19b85380f8f20 05-Sep-2011 Richard Smith <richard-llvm@metafoo.co.uk> Implement the suggested resolution of WG21 N3307 issue 19: When determining whether a class is an aggregate in C++0x, treat all functions which are neither deleted nor defaulted as user-provided, not just special member functions. The wording of the standard only defines the term "user-provided" for special member functions, but the intent seems to be that any function can be user-provided.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139111 91177308-0d34-0410-b5e6-96231b3b80d8
cl.decl/dcl.init/dcl.init.aggr/p1-0x.cpp
87e96eb04ba26022e03263da9d75299ea72adb8f 04-Sep-2011 Richard Smith <richard-llvm@metafoo.co.uk> PR10458: Last part of providing 'auto' type specifier as an extension in C++98: permit it within type-ids.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139103 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p4.cpp
8f4fb190852d3f86787c7e2c3dfc1b96143197ae 04-Sep-2011 Richard Smith <richard-llvm@metafoo.co.uk> PR10458: Finesse behaviour of C++0x features when in pre-0x mode. Accept for-range and auto with an ExtWarn, and produce a -Wc++0x-compat warning in C++98 mode when auto is used as a storage class.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139102 91177308-0d34-0410-b5e6-96231b3b80d8
lass/class.friend/p6.cpp
cl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p3.cpp
cl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p4.cpp
cl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p6.cpp
cl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p7.cpp
74e611a5fd0b5977c664d13a07b625ae23527d0d 04-Sep-2011 Sebastian Redl <sebastian.redl@getdesigned.at> Add test case for defaulted copy and move structure validation.
Fix bug this uncovered.
Address minor comments from Doug.
Enable cxx_implicit_moves feature.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139101 91177308-0d34-0410-b5e6-96231b3b80d8
cl.decl/dcl.meaning/dcl.fct/dcl.fct.def.default/p2.cpp
45d3d716622f12f9d8e77f2e4c8ffddf4bfe3559 01-Sep-2011 Douglas Gregor <dgregor@apple.com> When defining the implicit move assignment operator, don't perform
semantic analysis when taking the address of an xvalue. Instead, just
build the unary operator directly, since it's safe to do so (from the
IRgen and AST perspectives) for any glvalue. Fixes PR10822.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138935 91177308-0d34-0410-b5e6-96231b3b80d8
pecial/class.copy/implicit-move-def.cpp
1155c42e7b1b4e401bb0a331a6d715d637958c75 31-Aug-2011 Douglas Gregor <dgregor@apple.com> Allow C99 hexfloats in C++0x mode. This change resolves the standards
collision between C99 hexfloats and C++0x user-defined literals by
giving C99 hexfloats precedence. Also, warning about user-defined
literals that conflict with hexfloats and those that have names that
are reserved by the implementation. Fixes <rdar://problem/9940194>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138839 91177308-0d34-0410-b5e6-96231b3b80d8
ex/lex.literal/lex.ext/p1.cpp
b89d5ed785e2eb7dd64aa38d481d939155f62c41 31-Aug-2011 Jeffrey Yasskin <jyasskin@google.com> Fix PR10694: Boolean conversions can be from pointers, and those conversions
aren't considered narrowing conversions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138838 91177308-0d34-0410-b5e6-96231b3b80d8
cl.decl/dcl.init/dcl.init.list/p7-0x.cpp
85ea7aa961deac1d754f610af8062ae3f8b4e2a5 30-Aug-2011 Sebastian Redl <sebastian.redl@getdesigned.at> Declare and define implicit move constructor and assignment operator.

This makes the code duplication of implicit special member handling even worse,
but the cleanup will have to come later. For now, this works.
Follow-up with tests for explicit defaulting and enabling the __has_feature
flag to come.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138821 91177308-0d34-0410-b5e6-96231b3b80d8
cl.decl/dcl.init/p14-0x.cpp
pecial/class.copy/implicit-move-def.cpp
pecial/class.copy/implicit-move.cpp
pecial/class.inhctor/p3.cpp
tmt.stmt/stmt.iter/stmt.ranged/p1.cpp
emp/temp.decls/temp.variadic/p4.cpp
9906149972906e340f512a60f72a8676748f24d8 29-Aug-2011 Jeffrey Yasskin <jyasskin@google.com> Print 'int' instead of 'const int' in the narrowing conversion error, since the
qualification of a type doesn't affect whether a conversion is a narrowing
conversion.
This doesn't work in template cases because SubstTemplateTypeParmType gets in
the way.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138735 91177308-0d34-0410-b5e6-96231b3b80d8
cl.decl/dcl.init/dcl.init.list/p7-0x.cpp
96a914a50cb8c01be8a3b7481cc4791e19c4285b 28-Aug-2011 John McCall <rjmccall@apple.com> Disable the l-value to r-value conversion on C++ class types passed
to varargs functions in unevaluated contexts. AFAICT, there is no
standards justification for this, but it matches what other compilers do
and therefore preserves compatibility with certain template metaprogramming
idioms.

Should fix self-host.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138715 91177308-0d34-0410-b5e6-96231b3b80d8
pecial/class.temporary/p1.cpp
5f8d604246976a93a73549b07bbc8ee0b2061b50 27-Aug-2011 John McCall <rjmccall@apple.com> The lvalue-to-rvalue on structs in C++ is actually part
of default argument promotion and needs to happen unconditionally.
This is particularly semantically important in C++0x.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138691 91177308-0d34-0410-b5e6-96231b3b80d8
pecial/class.temporary/p1.cpp
af1fc7af351758b0ea0d285bdfe5640128109a4e 15-Aug-2011 Richard Smith <richard-llvm@metafoo.co.uk> Track in the AST whether a function is constexpr.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137653 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/dcl.spec/dcl.constexpr/p1.cpp
cl.dcl/dcl.spec/dcl.constexpr/p2.cpp
f20d27288c7f124dcc9c50c7c6bf766d522ceb31 15-Aug-2011 Douglas Gregor <dgregor@apple.com> Teach reference initialization from the result of a user-defined
conversion to initialize the standard conversion *after* the
user-defined conversion properly. Fixes PR10644.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137608 91177308-0d34-0410-b5e6-96231b3b80d8
cl.decl/dcl.init/dcl.init.ref/p5-0x.cpp
6d0ee8d77b6d37fa0dec1d55aa13429a6608e7a9 12-Aug-2011 Jeffrey Yasskin <jyasskin@google.com> Conversions to bool count as integer conversions for the purposes of
the C++0x narrowing error.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137512 91177308-0d34-0410-b5e6-96231b3b80d8
cl.decl/dcl.init/dcl.init.list/p7-0x.cpp
ddddd48da72bc29d1c3f388ed91ea5549328129e 12-Aug-2011 NAKAMURA Takumi <geek4civic@gmail.com> De-Unicode-ify.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137430 91177308-0d34-0410-b5e6-96231b3b80d8
asic/basic.lookup/basic.lookup.classref/p3.cpp
a6d1e7623a9b7bd60779275c42827951a892993b 10-Aug-2011 Douglas Gregor <dgregor@apple.com> When performing the lookup in the current scope for a member access to
a member template, e.g.,

x.f<int>

if we have found a template in the type of x, but the lookup in the
current scope is ambiguous, just ignore the lookup in the current
scope. Fixes <rdar://problem/9915664>.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137255 91177308-0d34-0410-b5e6-96231b3b80d8
asic/basic.lookup/basic.lookup.classref/p1.cpp
036e81c79805364d984af2be06be62562e08c980 10-Aug-2011 Douglas Gregor <dgregor@apple.com> Expand test of C++0x [class.copymove]p15 to make sure we're actually calling the copy constructor of a base/member from an explicitly-defaulted copy constructor, rather than the default constructor

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137220 91177308-0d34-0410-b5e6-96231b3b80d8
pecial/class.copy/p15-0x.cpp
136da1c4320156fe8924139f58fbeed2e32cc6e8 10-Aug-2011 Douglas Gregor <dgregor@apple.com> When adding the base and member initializers for an implicitly-defined
special member function, make sure to classify an explicitly-defaulted
copy constructor as a "copy" operation. Fixes PR10622.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137219 91177308-0d34-0410-b5e6-96231b3b80d8
pecial/class.copy/p15-0x.cpp
53afad5ebbfd47e932405af5b93177ea0d68e3f4 29-Jul-2011 Douglas Gregor <dgregor@apple.com> This patch makes the string/character literal tests run in C,
C++98/03, and C++0x mode, from Craig Topper!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136443 91177308-0d34-0410-b5e6-96231b3b80d8
ex/lex.literal/lex.ccon/p1.cpp
9aab1489866a5afe1a8a3267f9ad7124034fd644 29-Jul-2011 Peter Collingbourne <peter@pcc.me.uk> Fix an inconsistency in Sema::ConvertArgumentsForCall in that
the callee note diagnostic was not emitted in the case where
there were too few arguments.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136437 91177308-0d34-0410-b5e6-96231b3b80d8
cl.decl/dcl.meaning/dcl.fct.default/p10.cpp
cl.decl/dcl.meaning/dcl.fct.default/p4.cpp
5cee1195584fa8672253139c86e922daeda69b9e 27-Jul-2011 Douglas Gregor <dgregor@apple.com> Add support for C++0x unicode string and character literals, from Craig Topper!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136210 91177308-0d34-0410-b5e6-96231b3b80d8
ex/lex.literal/lex.ccon/p1.cpp
191591336f639dad1504e863733fb831645c1644 27-Jul-2011 Jeffrey Yasskin <jyasskin@google.com> This patch implements as much of the narrowing conversion error specified by
[dcl.init.list] as is possible without generalized initializer lists or full
constant expression support, and adds a c++0x-compat warning in C++98 mode.

The FixIt currently uses a typedef's basename without qualification, which is
likely to be incorrect on some code. If it's incorrect on too much code, we
should write a function to get the string that refers to a type from a
particular context.

The warning is currently off by default. I'll fix LLVM and clang before turning
it on.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136181 91177308-0d34-0410-b5e6-96231b3b80d8
cl.decl/dcl.init/dcl.init.list/p7-0x-fixits.cpp
cl.decl/dcl.init/dcl.init.list/p7-0x.cpp
12ce0a085f89f07c76bf034aa6b838ef50542241 15-Jul-2011 Rafael Espindola <rafael.espindola@gmail.com> Revert 135177 to fix PR10363.

Revert "For C++11, do more checking of initializer lists up-front, enabling some subset of the final functionality. C just leaves the function early. C++98 runs through the same code path, but has no changed functionality either."

This reverts commit ac420c5053d6aa41d59f782caad9e46e5baaf2c2.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135210 91177308-0d34-0410-b5e6-96231b3b80d8
cl.decl/dcl.init/dcl.init.aggr/p1-0x.cpp
cf6b0a20c697ba8daf2dff3a4cce2a028b33cb48 14-Jul-2011 Richard Smith <richard-llvm@metafoo.co.uk> PR10359: Template declarations which define classes are not permitted to also contain declarators. Previously we would accept code like this:

template<typename T> struct S { } f() { return 0; }

This case now produces a missing ';' diagnostic, since that seems like a much more likely error than an attempt to declare a function or variable in addition to the class template.

Treat this


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135195 91177308-0d34-0410-b5e6-96231b3b80d8
emp/p3.cpp
emp/temp.res/temp.local/p3.cpp
ac420c5053d6aa41d59f782caad9e46e5baaf2c2 14-Jul-2011 Sebastian Redl <sebastian.redl@getdesigned.at> For C++11, do more checking of initializer lists up-front, enabling some subset of the final functionality. C just leaves the function early. C++98 runs through the same code path, but has no changed functionality either.
This is a first baby step towards supporting generalized initializer lists. This also removes an aggregate
test case that was just plain wrong, assuming that non-aggregates couldn't be initialized with initializer lists
in C++11 mode.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135177 91177308-0d34-0410-b5e6-96231b3b80d8
cl.decl/dcl.init/dcl.init.aggr/p1-0x.cpp
9cbe4f0ba01ec304e1e3d071c071f7bca33631c0 09-Jul-2011 Chris Lattner <sabre@nondot.org> clang side to match the LLVM IR type system rewrite patch.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134831 91177308-0d34-0410-b5e6-96231b3b80d8
xcept/except.spec/p14-ir.cpp
bca01b46850f867b2f4137f25c882022b58f8471 07-Jul-2011 Douglas Gregor <dgregor@apple.com> Properly implement the scope restriction on the NRVO for
throw-expressions, such that we don't consider the NRVO when the
non-volatile automatic object comes from outside the innermost try
scope (C++0x [class.copymove]p13). In C++98/03, our ASTs were
incorrect but it didn't matter because IR generation doesn't actually
apply the NRVO here. In C++0x, however, we were moving from an object
when in fact we should have copied from it. Fixes PR10142 /
<rdar://problem/9714312>.





git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134548 91177308-0d34-0410-b5e6-96231b3b80d8
pecial/class.copy/p33-0x.cpp
31862ba5ea70b1f2c81d03f8a0100b61cd6f06f6 02-Jul-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> [ARC] When casting from a pointer to an objective-c object with known ownership, if the
cast type has no ownership specified, implicitly "transfer" the ownership of the cast'ed type
to the cast type:

id x;
static_cast<NSString**>(&x); // Casting as (__strong NSString**).

This currently only works for C++ named casts, C casts to follow.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134273 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p5.cpp
be098b32bf601a33b0977ae88b76b22854b929e2 29-Jun-2011 Chandler Carruth <chandlerc@gmail.com> Update this test to reflect the new (deterministic) order in r134038.

This was part of Kaelyn's original patch that got dropped while I was
working on it, but after I ran my tests. =/ Sorry.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134039 91177308-0d34-0410-b5e6-96231b3b80d8
asic/basic.lookup/basic.lookup.argdep/p4.cpp
ea76d8a9961ed1af728f07682c194a3d60524144 29-Jun-2011 Chad Rosier <mcrosier@apple.com> Modify test case to allow buildbots to make forward progress. This test should
now (incorrectly) pass. Once the appropriate fixes have been made this test
should be reverted.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134035 91177308-0d34-0410-b5e6-96231b3b80d8
asic/basic.lookup/basic.lookup.argdep/p4.cpp
d8bba9c15230d2b1b3893e272106aa79efc50251 28-Jun-2011 Douglas Gregor <dgregor@apple.com> Add support for C++ namespace-aware typo correction, e.g., correcting

vector<int>

to

std::vector<int>

Patch by Kaelyn Uhrain, with minor tweaks + PCH support from me. Fixes
PR5776/<rdar://problem/8652971>.

Thanks Kaelyn!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134007 91177308-0d34-0410-b5e6-96231b3b80d8
asic/basic.lookup/basic.lookup.argdep/p4.cpp
13b21be065e9feb0759303bd51b8e8653130f0fb 27-Jun-2011 Chandler Carruth <chandlerc@gmail.com> Factor out (some of) the checking for invalid forms of pointer
arithmetic into a couple of common routines. Use these to make the
messages more consistent in the various contexts, especially in terms of
consistently diagnosing binary operators with invalid types on both the
left- and right-hand side. Also, improve the grammar and wording of the
messages some, handling both two pointers and two (different) types.

The wording of function pointer arithmetic diagnostics still strikes me
as poorly phrased, and I worry this makes them slightly more awkward if
more consistent. I'm hoping to fix that with a follow-on patch and test
case that will also make them more helpful when a typedef or template
type parameter makes the type completely opaque.

Suggestions on better wording are very welcome, thanks to Richard Smith
for some initial help on that front.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133906 91177308-0d34-0410-b5e6-96231b3b80d8
tmt.stmt/stmt.iter/stmt.ranged/p1.cpp
emp/temp.spec/temp.explicit/p7.cpp
18e0461ad72dcf6ec93cd3b1df7bf1b5a30b10b7 18-Jun-2011 Chandler Carruth <chandlerc@gmail.com> Accept no-return stripping conversions for pointer type arguments after
deducing template parameter types. Recently Clang began enforcing the
more strict checking that the argument type and the deduced function
parameter type (after substitution) match, but that only consideres
qualification conversions.

One problem with this patch is that we check noreturn conversions and
qualification conversions independently. If a valid conversion would
require *both*, perhaps interleaved with each other, it will be
rejected. If this actually occurs (I'm not yet sure it does) and is in
fact a problem (I'm not yet sure it is), there is a FIXME to implement
more intelligent conversion checking.

However, this step at least allows Clang to resume accepting valid code
we're seeing in the wild.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133327 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.fct.spec/temp.deduct/temp.deduct.call/p3.cpp
9a636e8403287af0d4db8fe5bf49dee719f5b754 17-Jun-2011 Douglas Gregor <dgregor@apple.com> Extend the deduced/actual argument type checking of C++
[temp.deduct.call]p4 to the deduction performed for 'auto', finishing
the fix for PR9233.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133239 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p6.cpp
0f9dc86a14068e04e0d2cc6b4ff15eca571236ce 17-Jun-2011 Douglas Gregor <dgregor@apple.com> When an explicit specialization has a storage specifier, error if that
storage specifier is different from the storage specifier on the
template. If that storage specifier is the same, then we only warn.

Thanks to John for the prodding.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133236 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/dcl.spec/dcl.stc/p1.cpp
51d7cdd4bfd11e0eeac55517419d0ebba0abb4cb 17-Jun-2011 Douglas Gregor <dgregor@apple.com> Downgrade the error complaining about presence of a storage class
specifier on an explicit specialization to a warning, since neither
EDG nor GCC diagnose this code as ill-formed.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133232 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/dcl.spec/dcl.stc/p1.cpp
dbfb371e297794e827ad2e5b33b45fafbfc46b29 16-Jun-2011 Douglas Gregor <dgregor@apple.com> Implement the consistency checking for C++ [temp.deduct.call]p3, which
checks that the deduced argument type for a function call matches the
actual argument type provided. The only place we've found where the
consistency checking should actually cause template argument deduction
failure is due to qualifier differences that don't fall into the realm
of qualification conversions (which are *not* checked when we
initially perform deduction). However, we're performing the full
checking as specified in the standard to ensure that no other cases
exist.

Fixes PR9233 / <rdar://problem/9039590>.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133163 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.fct.spec/temp.deduct/temp.deduct.call/p3.cpp
1454cb952b76a7dc441f2ae1b7f8d998a54a23cf 15-Jun-2011 Douglas Gregor <dgregor@apple.com> Properly implement C++0x [stmt.dcl]p3, which requires a scope to be
protected in the case where a variable is being initialized by a
trivial default constructor but has a non-trivial destructor.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133037 91177308-0d34-0410-b5e6-96231b3b80d8
tmt.stmt/stmt.dcl/p3-0x.cpp
1abd35950bcb0761887dca0995c68b8a9dc8916f 14-Jun-2011 Douglas Gregor <dgregor@apple.com> When profiling FunctionProtoTypes, don't canonicalize the expression
in a noexcept exception specification because it isn't part of the
canonical type. This ensures that we keep the exact expression written
in the noexcept exception specification, rather than accidentally
"adopting" a previously-written and canonically "equivalent" function
prototype. Fixes PR10087.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132998 91177308-0d34-0410-b5e6-96231b3b80d8
xcept/except.spec/canonical.cpp
7ec1b7a537951f80c6531103ee4787d12e696630 12-Jun-2011 Richard Smith <richard-llvm@metafoo.co.uk> Test for C++11 [class]p6 (trivial classes).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132889 91177308-0d34-0410-b5e6-96231b3b80d8
lass/p6-0x.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
lass/class.mem/p5-0x.cpp
cl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p4.cpp
cl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p5.cpp
cl.dcl/dcl.spec/dcl.type/p3-0x.cpp
cl.decl/dcl.init/dcl.init.aggr/p1-0x.cpp
cl.decl/dcl.init/p14-0x.cpp
xcept/except.spec/p14.cpp
xpr/expr.prim/p12-0x.cpp
xpr/expr.prim/p4-0x.cpp
pecial/class.ctor/p5-0x.cpp
pecial/class.init/class.base.init/p8-0x.cpp
pecial/class.init/class.base.init/p9-0x.cpp
5b01b8319012c6b568de6dfff935c1b16184952f 07-Jun-2011 Douglas Gregor <dgregor@apple.com> Downgrade the warning about the use of typedefs for class template
specializations within an explicit instantiation to default to off
(enabled by -pedantic). Nobody else seem to implement C++
[temp.explicit]p3. Fixes PR10093.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132704 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.spec/temp.explicit/p2.cpp
2e283f00fe9502150cf41bb1db70a5cd16693794 06-Jun-2011 Eli Friedman <eli.friedman@gmail.com> Start fixing up clang tests to work on the clang-native-arm-cortex-a9 builder.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132691 91177308-0d34-0410-b5e6-96231b3b80d8
pecial/class.dtor/p3-0x.cpp
89b9f10cca9e2812b3e7943d3150fe6c9028bbe4 06-Jun-2011 Douglas Gregor <dgregor@apple.com> Diagnose the condition in C++ [temp.expl.spec]p16 that prohibits
specializing a member of an unspecialized template, and recover from
such errors without crashing. Fixes PR10024 / <rdar://problem/9509761>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132677 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.spec/temp.expl.spec/p16.cpp
8735b294a257a07ca158c28094d7324f0adf889a 03-Jun-2011 Douglas Gregor <dgregor@apple.com> When checking the instantiation of a default template argument against
the template parameter, perform the checking as a "specified" template
argument rather than a "deduced" template argument; the latter implies
stricter type checking that is not permitted for default template
arguments.

Also, cleanup our handling of substitution of explicit template
arguments for a function template. We were actually performing some
substitution of default arguments at this point!

Fixes PR10069.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132529 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.param/p9-0x.cpp
95ea45072a46ba3c85fc588aed15509a1a0900ed 02-Jun-2011 Douglas Gregor <dgregor@apple.com> Fix an incorrect warning about explicit template specializations for
nested types, from Michael Han!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132431 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.spec/temp.expl.spec/examples.cpp
3617e198aa89d4aa0921343a22b96823a63f8a58 01-Jun-2011 Douglas Gregor <dgregor@apple.com> The expression in a noexcept exception-specification is a
constant-expression, and, therefore, an unevaluated operand. Make it
so.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132400 91177308-0d34-0410-b5e6-96231b3b80d8
xcept/except.spec/p1.cpp
93c332a8ba2c193c435b293966d343dab15f555b 28-May-2011 John McCall <rjmccall@apple.com> Convert Clang over to resuming from landing pads with llvm.eh.resume.
It's quite likely that this will explode, but I need to know how. :)



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132269 91177308-0d34-0410-b5e6-96231b3b80d8
xcept/except.spec/p9-dynamic.cpp
addd80d1c80d1e9f249988452103c93a564945f0 27-May-2011 Eli Friedman <eli.friedman@gmail.com> Back out r132209; it's breaking nightly tests.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132219 91177308-0d34-0410-b5e6-96231b3b80d8
xcept/except.spec/p9-dynamic.cpp
f61103ef335fb273a98c1389e6fddaf796feb4b3 27-May-2011 Douglas Gregor <dgregor@apple.com> Clean up my changes to jump-diagnostic handling for local variables of
class type (or array thereof), eliminating some redundant checks
(thanks Eli!) and adding some tests where the behavior differs in
C++98/03 vs. C++0x.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132218 91177308-0d34-0410-b5e6-96231b3b80d8
tmt.stmt/stmt.dcl/p3-0x.cpp
tmt.stmt/stmt.dcl/p3.cpp
0903421e36c174a82597f83bd296f3cd5b5f169b 27-May-2011 John McCall <rjmccall@apple.com> Implement a new, much improved version of the cleanup hack. We just need
to be careful to emit landing pads that are always prepared to handle a
cleanup path. This is correct mostly because of the fix to the LLVM
inliner, r132200.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132209 91177308-0d34-0410-b5e6-96231b3b80d8
xcept/except.spec/p9-dynamic.cpp
e413516d0ed61ef9e2ff706bcc00480adca947c4 27-May-2011 Douglas Gregor <dgregor@apple.com> Update the jump-scope checker for local variables with initializers,
so that it looks at the initializer of a local variable of class type
(or array thereof) to determine whether it's just an implicit
invocation of the trivial default constructor. Fixes PR10034.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132191 91177308-0d34-0410-b5e6-96231b3b80d8
tmt.stmt/stmt.dcl/p3.cpp
82713174914bdb927a254c5ee188e35fd79c4948 26-May-2011 Sean Hunt <scshunt@csclub.uwaterloo.ca> Update our diagnostics to properly account for move operations.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132096 91177308-0d34-0410-b5e6-96231b3b80d8
lass.access/p4.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/expr.const/p2-0x.cpp
9625e44c0252485277a340746ed8ac950686156f 22-May-2011 Douglas Gregor <dgregor@apple.com> It's considered poor form to create references to the overloaded
function type. Educate template argument deduction thusly, fixing
PR9974 / <rdar://problem/9479155>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131811 91177308-0d34-0410-b5e6-96231b3b80d8
tmt.stmt/stmt.iter/stmt.ranged/p1.cpp
e885e188b25dc218132402d1f48fb35e175bfb2e 21-May-2011 Douglas Gregor <dgregor@apple.com> Diagnose the presence of storage-class-specifiers on explicit
instantiations and specializations. Fixes <rdar://problem/9126453> and PR8700.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131802 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/dcl.spec/dcl.stc/p1.cpp
4337dc776074ac0143b49823890303f952d3d9ae 21-May-2011 Douglas Gregor <dgregor@apple.com> Teach Sema::ActOnUninitializedDecl() not to try to interpret when one
should use a constructor to default-initialize a
variable. InitializationSequence knows the rules for default
initialization, better. Fixes <rdar://problem/8501008>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131796 91177308-0d34-0410-b5e6-96231b3b80d8
asic/basic.lookup/basic.lookup.argdep/p4.cpp
cl.decl/dcl.init/p6.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/expr.post/expr.call/p7-0x.cpp
b7ec906b189f71ab35825bdb60fb1f6c4c40880b 20-May-2011 Douglas Gregor <dgregor@apple.com> Downgrade the error about re-opening an inline namespace as non-inline
to a warning, since apparently libstdc++'s debug mode does this (and
we can recover safely). Add a Fix-It to insert the "inline", just for kicks.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131732 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/basic.namespace/namespace.def/p7.cpp
fc92137eee708b632c00a9b0934ff87aeae234a5 20-May-2011 Douglas Gregor <dgregor@apple.com> Diagnose unexpanded parameter packs in return statements. This
manifested in a crash with blocks in PR9953, but it was a ticking time
bomb for normal functions, too. Fixes PR9953.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131731 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.variadic/ext-blocks.cpp
a0448264c7da395ca9416c6570bc43a7f49e436b 20-May-2011 Sebastian Redl <sebastian.redl@getdesigned.at> Fix PR9941 for out-of-line template destructors too.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131722 91177308-0d34-0410-b5e6-96231b3b80d8
pecial/class.dtor/p3-0x.cpp
1e55e91a257c4ddd4364656b048a3c345c366804 20-May-2011 Matt Beaumont-Gay <matthewbg@google.com> Undo enough of r131143 to make private copy ctor diags say "copy constructor" again

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131706 91177308-0d34-0410-b5e6-96231b3b80d8
lass.access/p4.cpp
42bef03a0f0462a95eb66b9e63feab0bf596134d 19-May-2011 Sebastian Redl <sebastian.redl@getdesigned.at> Fix PR9941 again, this time for templates.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131640 91177308-0d34-0410-b5e6-96231b3b80d8
pecial/class.dtor/p3-0x.cpp
0ee33912f8ec3453856c8a32ed2c2e8007bed614 19-May-2011 Sebastian Redl <sebastian.redl@getdesigned.at> Reapply r121528, fixing PR9941 by delaying the exception specification check for destructors until the class is complete and destructors have been adjusted.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131632 91177308-0d34-0410-b5e6-96231b3b80d8
pecial/class.dtor/p3-0x.cpp
1d78032167c2f2d470e4270aadcb07ff71e6c7e1 18-May-2011 Sean Hunt <scshunt@csclub.uwaterloo.ca> Revert r121528 as it breaks a simple testcase, which leads to, among
other things, libcxx not building.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131573 91177308-0d34-0410-b5e6-96231b3b80d8
pecial/class.dtor/p3-0x.cpp
0320a1d7b3305d1aef36ee68b77bebe170e1d30a 18-May-2011 Sebastian Redl <sebastian.redl@getdesigned.at> Implement implicit exception specifications of destructors.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131528 91177308-0d34-0410-b5e6-96231b3b80d8
pecial/class.dtor/p3-0x.cpp
714c992099b3b9442759f29038bb3f2c5a59a23d 15-May-2011 Douglas Gregor <dgregor@apple.com> When checking a set of template parameter lists against a
nested-name-specifier, re-evaluate the nested-name-specifier as if we
were entering that context (which we did!), so that we'll resolve a
template-id to a particular class template partial
specialization. Fixes PR9913.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131383 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.spec/temp.expl.spec/examples.cpp
1804174e1591bf59118f317775b48edd0382c3f0 14-May-2011 Richard Smith <richard-llvm@metafoo.co.uk> PR9908: Fix the broken fix for PR9902 to get the template argument lists in the right order.
Also, don't reject alias templates in all ElaboratedTypes: some ElaboratedTypes do not correspond to elaborated-type-specifiers.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131342 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/dcl.spec/dcl.type/dcl.type.elab/p2-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/expr.unary/expr.unary.noexcept/sema.cpp
7822ee3ef9f0d5cfd289258614ac31be70097449 12-May-2011 Douglas Gregor <dgregor@apple.com> Implement CWG1170, which makes access-control errors into template
argument deduction failures. Only implemented in C++0x, since this is
a significant change in behavior from C++98/03.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131209 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.fct.spec/temp.deduct/cwg1170.cpp
175c5bb2b09217df71319cb3d58b3c511fd04138 12-May-2011 Douglas Gregor <dgregor@apple.com> When checking for the necessary 'template<>' headers based on the
nested of an out-of-line declaration, only require a 'template<>'
header for each enclosing class template that hasn't been previously
specialized; previously, we were requiring 'template<>' for enclosing
class templates and members of class templates that hadn't been
previously specialized. Fixes <rdar://problem/9422013>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131207 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.spec/temp.expl.spec/examples.cpp
emp/temp.spec/temp.expl.spec/p15.cpp
emp/temp.spec/temp.expl.spec/p5-example.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/expr.unary/expr.unary.noexcept/sema.cpp
44054452c416a622b8f19a6d157a0affc05b9aa8 10-May-2011 Douglas Gregor <dgregor@apple.com> Tweak the diagnostics for the C++0x extensions to friend types to note
that they are C++0x extensions, and put them in the appropriate
group. We already support most of the semantics. Addresses
<rdar://problem/9407525>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131153 91177308-0d34-0410-b5e6-96231b3b80d8
lass.access/class.friend/p2-cxx03.cpp
lass/class.friend/p2.cpp
f961ea5716867b5e426fb2136edd6d1f04c3a7ca 10-May-2011 Sean Hunt <scshunt@csclub.uwaterloo.ca> Re-do R131114 without breaking code.

I've edited one diagnostic which would print "copy constructor" for copy
constructors and "constructor" for any other constructor. If anyone is
extremely enamored with this, it can be reinstated with a simple boolean
flag rather than calling getSpecialMember, which is inappropriate.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131143 91177308-0d34-0410-b5e6-96231b3b80d8
lass.access/p4.cpp
c840649ed5acccf68e1bc5a9d22f2ea017074586 10-May-2011 Douglas Gregor <dgregor@apple.com> Reimplement Sema::MatchTemplateParametersToScopeSpecifier() based on
the semantic context referenced by the nested-name-specifier rather
than the syntactic form of the nested-name-specifier. The previous
incarnation was based on my complete misunderstanding of C++
[temp.expl.spec]. The latest C++0x working draft clarifies the
requirements here, and this rewrite is intended to follow that.

Along the way, improve source location information in the
diagnostics. For example, if we report that a specific type needs or
doesn't need a 'template<>' header, we dig out that type in the
nested-name-specifier and highlight its range.

Fixes: PR5907, PR9421, PR8277, PR8708, PR9482, PR9668, PR9877, and
<rdar://problem/9135379>.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131138 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.spec/temp.expl.spec/examples.cpp
emp/temp.spec/temp.expl.spec/p17.cpp
536e9c1f103f3e59ed47e35090819eb93596c35b 06-May-2011 Richard Smith <richard-llvm@metafoo.co.uk> Slight tweak to alias template error handling: don't guess that a template-id in an alias declaration was meant to be a specialization. Use a generic, but more accurate, diagnostic.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130961 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/p3.cpp
3e4c6c4c79a03f5cb0c4671d7c282d623c6dc35e 05-May-2011 Richard Smith <richard-llvm@metafoo.co.uk> Implement support for C++0x alias templates.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130953 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/dcl.spec/dcl.type/dcl.type.elab/p2-0x.cpp
cl.dcl/dcl.spec/dcl.type/p3-0x.cpp
emp/temp.decls/p3.cpp
emp/temp.decls/temp.alias/p1.cpp
emp/temp.decls/temp.alias/p2.cpp
emp/temp.decls/temp.alias/p3.cpp
emp/temp.param/p10-0x.cpp
emp/temp.param/p11-0x.cpp
emp/temp.res/temp.dep/temp.dep.type/p1.cpp
emp/temp.type/p1-0x.cpp
4f40ddde58cb9bebcd23eb3ef3c1b399bac4d938 04-May-2011 Richard Trieu <rtrieu@google.com> Fix a typo in a test.
CHEKC -> CHECK



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130809 91177308-0d34-0410-b5e6-96231b3b80d8
lass/class.mem/p1b.cpp
0f4be74ff0273e505d383f89174ef539828424ed 03-May-2011 Chandler Carruth <chandlerc@gmail.com> When parsing a template friend declaration we dropped the template
parameters on the floor in certain cases:
class X {
template <typename T> friend typename A<T>::Foo;
};

This was parsed as a *non* template friend declaration some how, and
received an ExtWarn. Fixing the parser to actually provide the template
parameters to the freestanding declaration parse triggers the code which
specifically looks for such constructs and hard errors on them.

Along the way, this prevents us from trying to instantiate constructs
like the above inside of a outer template. This is important as loosing
the template parameters means we don't have a well formed declaration
and template instantiation will be unable to rebuild the AST. That fixes
a crash in the GCC test suite.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130772 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.friend/p3.cpp
d46a1125d43bcfd47fbd1206ebd1226863549390 27-Apr-2011 John McCall <rjmccall@apple.com> Diagnose attempts to implicitly instantiate a template before it is
fully defined. Somehow this escaped notice for a very long time.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130298 91177308-0d34-0410-b5e6-96231b3b80d8
lass/class.mem/p2.cpp
3b887354b1b667c97d070ddc67b5354353c4c07b 27-Apr-2011 Douglas Gregor <dgregor@apple.com> Extend Sema::ClassifyName() to support C++, ironing out a few issues
in the classification of template names and using declarations. We now
properly typo-correct the leading identifiers in statements to types,
templates, values, etc. As an added bonus, this reduces the number of
lookups required for disambiguation.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130288 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p5.cpp
864c041e118155c2b1ce0ba36942a3da5a4a055e 26-Apr-2011 John McCall <rjmccall@apple.com> Make yet another placeholder type, this one marking that an expression is a bound
member function, i.e. something of the form 'x.f' where 'f' is a non-static
member function. Diagnose this in the general case. Some of the new diagnostics
are probably worse than the old ones, but we now get this right much more
universally, and there's certainly room for improvement in the diagnostics.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130239 91177308-0d34-0410-b5e6-96231b3b80d8
ver/over.over/p2-resolve-single-template-id.cpp
162e1c1b487352434552147967c3dd296ebee2f7 15-Apr-2011 Richard Smith <richard-llvm@metafoo.co.uk> Support for C++11 (non-template) alias declarations.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129567 91177308-0d34-0410-b5e6-96231b3b80d8
asic/basic.scope/basic.scope.pdecl/p3.cpp
cl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p5.cpp
cl.dcl/dcl.spec/dcl.typedef/p2-0x.cpp
fc8f0e14ad142ed811e90fbd9a30e419e301c717 15-Apr-2011 Chris Lattner <sabre@nondot.org> fix a bunch of comment typos found by codespell. Patch by
Luis Felipe Strano Moraes!



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129559 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/dcl.spec/dcl.fct.spec/p4.cpp
ad762fcdc16b9e4705b12b09d92b8c026212b906 15-Apr-2011 Richard Smith <richard-llvm@metafoo.co.uk> Add support for C++0x's range-based for loops, as specified by the C++11 draft standard (N3291).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129541 91177308-0d34-0410-b5e6-96231b3b80d8
asic/basic.scope/basic.scope.local/p4-0x.cpp
cl.dcl/dcl.spec/dcl.type/p3-0x.cpp
tmt.stmt/stmt.iter/stmt.ranged/p1.cpp
emp/temp.decls/temp.variadic/p5.cpp
87a1e19735a27d84edc2ac1331c040e2fb4c3b1a 14-Apr-2011 Richard Smith <richard-llvm@metafoo.co.uk> Implement C++0x [lex.pptoken]p3's handling of <::.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129525 91177308-0d34-0410-b5e6-96231b3b80d8
ex/lex.pptoken/p3-0x.cpp
0d8dc460ae02e29d0b2abb4d6d093736e2f920ea 14-Apr-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> When creating an implicit member expression through a qualified-id, check that the class
named by the nested-name-specifier is same or base of the class in which the member expression appears.

It seems we also had an ill-formed test case, mon dieu! Fixes rdar://8576107.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129493 91177308-0d34-0410-b5e6-96231b3b80d8
lass/class.mfct/class.mfct.non-static/p3.cpp
99ace16bc6962f1fc3dc45bbbdf2eb74e555a8ad 12-Apr-2011 John McCall <rjmccall@apple.com> Template static data members can have weak_odr linkage, not just
weak linkage. Also, fix a problem where global weak variables
with non-trivial initializers were getting guard variables, or at
least were checking for them and then crashing.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129342 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.spec/temp.explicit/p1-emit.cpp
772afb15e9602de562ef740d4d91c083a31e1162 12-Apr-2011 John McCall <rjmccall@apple.com> This test works now; enable it.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129335 91177308-0d34-0410-b5e6-96231b3b80d8
lass/class.union/p1.cpp
bc34b1d7f4f371bfdebf68d66086f54586d68abe 11-Apr-2011 Eli Friedman <eli.friedman@gmail.com> PR9669: implement correct checking for [dcl.init.string]p2.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129260 91177308-0d34-0410-b5e6-96231b3b80d8
cl.decl/dcl.init/dcl.init.string/p2.cpp
fb8721ce4c6fef3739b1cbd1e38e3f1949462033 10-Apr-2011 John McCall <rjmccall@apple.com> Simplify calling CheckPlaceholderExpr, converge on it in a few places,
and move a vector-splat check to follow l-value conversion.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129254 91177308-0d34-0410-b5e6-96231b3b80d8
ver/over.over/p2-resolve-single-template-id.cpp
5862f0e1ac29c5af8089b4bf119fd4493f6ab58c 04-Apr-2011 Ted Kremenek <kremenek@apple.com> When emitting a "too many arguments to function call..." error, also include a note with a location for the function prototype.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128833 91177308-0d34-0410-b5e6-96231b3b80d8
asic/basic.lookup/basic.lookup.argdep/p2.cpp
90434238b7edfc806437f1d40742a60ff92fbf6a 29-Mar-2011 Chandler Carruth <chandlerc@gmail.com> Fix a bug in how we were resolving the address of overloaded functions
when the resolution took place due to a single template specialization
being named with an explicit template argument list. In this case, the
"resolution" doesn't take into account the target type at all, and
therefore can take place for functions, static member functions, and
*non-static* member functions. The latter weren't being properly checked
and their proper form enforced in this scenario. We now do so.

The result of this last form slipping through was some confusing logic
in IsStandardConversion handling of these resolved address-of
expressions which eventually exploded in an assert. Simplify this logic
a bit and add some more aggressive asserts to catch improperly formed
expressions getting into this routine.

Finally add systematic testing of member functions, both static and
non-static, in the various forms they can take. One of these is
essentially PR9563, and this commit fixes the crash in that PR. However,
the diagnostics for this are still pretty terrible. We at least are now
accepting the correct constructs and rejecting the invalid ones rather
than accepting invalid or crashing as before.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128456 91177308-0d34-0410-b5e6-96231b3b80d8
ver/over.over/p2-resolve-single-template-id.cpp
b184a18a0a52e4bec33ef70f13bfcc29aafa14f2 25-Mar-2011 Anders Carlsson <andersca@mac.com> Replace the call to ParseOptionalCXX0XClassVirtSpecifierSeq with code to only parse an optional 'final' keyword.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128278 91177308-0d34-0410-b5e6-96231b3b80d8
lass/p1-0x.cpp
2c3ee54e51d835a35bbf781c69e17f39e2ba0480 25-Mar-2011 Anders Carlsson <andersca@mac.com> Get rid of handling of the 'explicit' keyword from class-head. We still parse it though, although that will change shortly.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128277 91177308-0d34-0410-b5e6-96231b3b80d8
lass.derived/p8-0x.cpp
844c25d4383ccaf44765687cc4a7e591b3fe1472 25-Mar-2011 Anders Carlsson <andersca@mac.com> Remove warnings about using override control keywords in inline function definitions; they will be allowed in the next C++0x draft.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128273 91177308-0d34-0410-b5e6-96231b3b80d8
lass/class.mem/p8-0x-pedantic.cpp
b1f39680a2e3bce508dba0600665860e5ba5fb70 25-Mar-2011 Anders Carlsson <andersca@mac.com> Remove 'new' from virt-specifier since it's going to be removed in the next C++0x draft

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128271 91177308-0d34-0410-b5e6-96231b3b80d8
lass/class.mem/p8-0x-pedantic.cpp
lass/class.mem/p8-0x.cpp
eef7ac5837ef3e0682ac0973121fff8edaa46ca4 16-Mar-2011 Douglas Gregor <dgregor@apple.com> Detect attempts to provide a specialization of a function within a
dependent scope and produce an error (rather than crashing). Fixes PR8979.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127749 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.spec/temp.expl.spec/p2.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/expr.unary/expr.unary.op/p6.cpp
emp/temp.fct.spec/temp.arg.explicit/p3-nodeduct.cpp
71fff644f9b680f3805070bc06c479681e05abaa 15-Mar-2011 Sebastian Redl <sebastian.redl@getdesigned.at> Fix test case.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127699 91177308-0d34-0410-b5e6-96231b3b80d8
xcept/except.spec/p3.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/expr.unary/expr.unary.noexcept/sema.cpp
d8f2e8ed63072ec5a1a8329aa772ae940f1dc3bc 15-Mar-2011 Sebastian Redl <sebastian.redl@getdesigned.at> More robust check for the special C++0x operator new workaround.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127692 91177308-0d34-0410-b5e6-96231b3b80d8
xcept/except.spec/p3.cpp
99439d474e7cb48497a2da4c35f70cdc1d5b153f 15-Mar-2011 Sebastian Redl <sebastian.redl@getdesigned.at> Implement a hack to work around the changing exception specification of operator new in C++0x.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127688 91177308-0d34-0410-b5e6-96231b3b80d8
xcept/except.spec/p3.cpp
a968e97947b1281c3bb3c4d47a952b3801d9bb02 15-Mar-2011 Sebastian Redl <sebastian.redl@getdesigned.at> Reintroduce r127617: "Code generation for noexcept." with fixes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127685 91177308-0d34-0410-b5e6-96231b3b80d8
xcept/except.spec/p9-dynamic.cpp
xcept/except.spec/p9-noexcept.cpp
112d5ee15a09f15e597037724e006004b3f2f78f 15-Mar-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Revert r127617: "Code generation for noexcept."

The tests fail in a -Asserts build.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127635 91177308-0d34-0410-b5e6-96231b3b80d8
xcept/except.spec/p9-dynamic.cpp
xcept/except.spec/p9-noexcept.cpp
f86d5f2b888573f7d72d7eeae7237cf6c5080958 14-Mar-2011 Sebastian Redl <sebastian.redl@getdesigned.at> Code generation for noexcept.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127617 91177308-0d34-0410-b5e6-96231b3b80d8
xcept/except.spec/p9-dynamic.cpp
xcept/except.spec/p9-noexcept.cpp
56fb926c93786739cfd0867e7ada31ace3bda946 14-Mar-2011 Sebastian Redl <sebastian.redl@getdesigned.at> Implement instantiation of noexcept spec and add a test case.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127603 91177308-0d34-0410-b5e6-96231b3b80d8
xcept/except.spec/template.cpp
9351b031c445a6bc37a8cfa7ab84fb6dfe55ae3a 14-Mar-2011 Sebastian Redl <sebastian.redl@getdesigned.at> Add another, pretty trivial, exception spec test case.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127602 91177308-0d34-0410-b5e6-96231b3b80d8
xcept/except.spec/p11.cpp
8999fe1bc367b3ecc878d135c7b31e3479da56f4 14-Mar-2011 Sebastian Redl <sebastian.redl@getdesigned.at> Make deallocation functions implicitly noexcept in C++0x.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127596 91177308-0d34-0410-b5e6-96231b3b80d8
xcept/except.spec/p15.cpp
caa35e4bbfccaaa6c4d69f29b3f1a8b544b3645e 12-Mar-2011 Sebastian Redl <sebastian.redl@getdesigned.at> Revert "Disable inherited constructors for 2.9."
It is only meant for the release branch.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127542 91177308-0d34-0410-b5e6-96231b3b80d8
pecial/class.inhctor/elsewhere.cpp
pecial/class.inhctor/p3.cpp
pecial/class.inhctor/p7.cpp
a808c544f9df4d17cb189ba6aa167478cf17ad4a 12-Mar-2011 Sebastian Redl <sebastian.redl@getdesigned.at> Disable inherited constructors for 2.9.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127541 91177308-0d34-0410-b5e6-96231b3b80d8
pecial/class.inhctor/elsewhere.cpp
pecial/class.inhctor/p3.cpp
pecial/class.inhctor/p7.cpp
60618fa7f88d5162bb5b40988b6b38d4d75d6fc6 12-Mar-2011 Sebastian Redl <sebastian.redl@getdesigned.at> Propagate the new exception information to FunctionProtoType.
Change the interface to expose the new information and deal with the enormous fallout.
Introduce the new ExceptionSpecificationType value EST_DynamicNone to more easily deal with empty throw specifications.
Update the tests for noexcept and fix the various bugs uncovered, such as lack of tentative parsing support.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127537 91177308-0d34-0410-b5e6-96231b3b80d8
xcept/except.spec/p1.cpp
xcept/except.spec/p2-dynamic-types.cpp
xcept/except.spec/p2-places.cpp
xcept/except.spec/p3.cpp
xcept/except.spec/p5-pointers.cpp
xcept/except.spec/p5-virtual.cpp
975cc644d5d9dafdb4060aa31c9753d0554e1308 10-Mar-2011 Daniel Dunbar <daniel@zuster.org> Revert r127206 "Detect attempts to provide a specialization of a function within
a...", it appears to cause us to reject various valid codes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127373 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.spec/temp.expl.spec/p2.cpp
db93fdee6c5a24e86ee5ed8c1d3b597e17d5893b 08-Mar-2011 Douglas Gregor <dgregor@apple.com> Detect attempts to provide a specialization of a function within a
dependent scope and produce an error (rather than crashing). Fixes PR8979.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127206 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.spec/temp.expl.spec/p2.cpp
cc20945c787a56abe418947fc6a2c520bcec66c0 07-Mar-2011 Douglas Gregor <dgregor@apple.com> Support explicit template specialization and instantiation for members
of a C++0x inline namespace within enclosing namespaces, as noted in
C++0x [namespace.def]p8.

Fixes <rdar://problem/9006349>, a libc++ failure where Clang was
rejected an explicit specialization of std::swap (since libc++ puts it
into an inline, versioned namespace std::__1).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127162 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/basic.namespace/namespace.def/p8.cpp
emp/temp.spec/temp.expl.spec/p2-0x.cpp
emp/temp.spec/temp.explicit/p3-0x.cpp
353ee246e754e38db9b738240d18f1ecf2bb389b 07-Mar-2011 Douglas Gregor <dgregor@apple.com> Produce a diagnostic for unused overloaded expressions, from Faisal Vali!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127148 91177308-0d34-0410-b5e6-96231b3b80d8
ver/over.over/p2-resolve-single-template-id.cpp
7acafd032e145dbdbbed9274ca57ec2c86b912bc 05-Mar-2011 Sebastian Redl <sebastian.redl@getdesigned.at> Parser support for noexcept specifications.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127086 91177308-0d34-0410-b5e6-96231b3b80d8
xcept/except.spec/p1.cpp
018591f524ca4f3a1e657d0d0a66eadf9dbd55f6 02-Mar-2011 John McCall <rjmccall@apple.com> Semantic checking for exception specifications should be triggered by
whether C++ exceptions are enabled, not exceptions in general. PR9358.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126820 91177308-0d34-0410-b5e6-96231b3b80d8
asic/basic.stc/basic.stc.dynamic/p2.cpp
xcept/except.spec/p14.cpp
emp/temp.decls/temp.variadic/p4.cpp
406f98f6a5a7bde5707085af8d66204e7e76af45 02-Mar-2011 Douglas Gregor <dgregor@apple.com> When we're substituting into a parameter-type-list nested inside the pattern
of an expansion, and we have a paramameter that is not a parameter
pack, don't suppress substitution of parameter packs within this
context.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126819 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.variadic/multi-level-substitution.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
lass.access/p4.cpp
cl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p2.cpp
cl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p5.cpp
cl.decl/dcl.meaning/dcl.fct/p13.cpp
xcept/except.handle/p16.cpp
xpr/expr.unary/expr.unary.noexcept/cg.cpp
xpr/expr.unary/expr.unary.noexcept/sema.cpp
pecial/class.copy/p33-0x.cpp
emp/temp.decls/temp.variadic/p5.cpp
12e3ecec906f65580059a9d8555849a272c2db81 23-Feb-2011 Fariborz Jahanian <fjahanian@apple.com> Provide Fixit warning when 'auto' is intended as storage
specifier in legacy code. Patch is reviewed offline by Doug.
// rdar://9036633.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126261 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p3.cpp
e7397c6a1bb2b205c5fe678e26199eb26d22e38e 22-Feb-2011 Richard Smith <richard-llvm@metafoo.co.uk> Fix a few auto-related issues:

* 'auto' was being rejected on abstract-declarators with trailing return
types and on typedefs with trailing return types. 'auto' is always
allowed in these cases. This was found while testing the fix for PR 9278.

* A very poor diagnostic was being issued for auto (f() -> int): "return
type must be 'auto', not 'auto'". This is closely related to PR 9060.

* Trailing return type handling was happening slightly too late,
resulting in the checks for functions returning arrays and functions
returning functions being missed.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126166 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p2.cpp
cl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p5.cpp
cl.decl/dcl.meaning/dcl.fct/p2-cxx0x.cpp
cl.decl/dcl.meaning/dcl.fct/p8-0x.cpp
cl.decl/dcl.meaning/dcl.fct/p9-0x.cpp
24d44eddfc98464d10802e71c77d3dc3e45f4aac 22-Feb-2011 Richard Smith <richard-llvm@metafoo.co.uk> Add reference to PR 9278 for archaeologists.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126164 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p5.cpp
ddc83f9255834217f0559b09ff75a1c50b8ce457 22-Feb-2011 Richard Smith <richard-llvm@metafoo.co.uk> C++0x's deduced auto is illegal in typedefs.

This actually rules out too much, since it also catches typedefs for pointers to functions with trailing return types:

typedef auto (*F)() -> int;

Fix for that (and the same issue in all abstract-declarators) to follow shortly.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126153 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p5.cpp
483b9f3bc05c5409e2c6643f1c9d91e21c8ff9d2 21-Feb-2011 Richard Smith <richard-llvm@metafoo.co.uk> Tweaks to C++0x deduced auto type support:
* Flag indicating 'we're parsing this auto typed variable's initializer' moved from VarDecl to Sema
* Temporary template parameter list for auto deduction is now allocated on the stack.
* Deduced 'auto' types are now uniqued.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126139 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p3.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
cl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p3.cpp
cl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p4.cpp
cl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p5.cpp
cl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p6.cpp
cl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p7.cpp
cl.decl/dcl.meaning/dcl.array/p1-cxx0x.cpp
cl.decl/dcl.meaning/dcl.fct/p2-cxx0x.cpp
xpr/expr.unary/expr.new/p2-cxx0x.cpp
1be8eec3ddd2a23c19b453c2639226174eb5d4a8 19-Feb-2011 Douglas Gregor <dgregor@apple.com> Handle the resolution of a reference to a function template (which
includes explicitly-specified template arguments) to a function
template specialization in cases where no deduction is performed or
deduction fails. Patch by Faisal Vali, fixes PR7505!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126048 91177308-0d34-0410-b5e6-96231b3b80d8
ver/over.over/p2-resolve-single-template-id.cpp
ver/over.over/p2.cpp
ver/over.over/p4.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
lass.access/p4.cpp
cl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p5.cpp
xcept/except.handle/p16.cpp
xpr/expr.unary/expr.unary.noexcept/cg.cpp
xpr/expr.unary/expr.unary.noexcept/sema.cpp
pecial/class.copy/p33-0x.cpp
emp/temp.decls/temp.variadic/p5.cpp
45f11b78750590b1b1bcec6746c7639a256ce2a2 19-Feb-2011 Chandler Carruth <chandlerc@gmail.com> Fix PR8767, improve diagnostic wording when allocating an object of an
abstract class type.

Patch by Stephen Hines, with a wording tweak from Doug applied by me.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125996 91177308-0d34-0410-b5e6-96231b3b80d8
lass.derived/class.abstract/p4.cpp
lass.derived/class.abstract/p5.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/expr.post/expr.static.cast/p9-0x.cpp
ad8dcf4a9df0e24051dc31bf9e6f3cd138a34298 17-Feb-2011 Chris Lattner <sabre@nondot.org> Step #1/N of implementing support for __label__: split labels into
LabelDecl and LabelStmt. There is a 1-1 correspondence between the
two, but this simplifies a bunch of code by itself. This is because
labels are the only place where we previously had references to random
other statements, causing grief for AST serialization and other stuff.

This does cause one regression (attr(unused) doesn't silence unused
label warnings) which I'll address next.

This does fix some minor bugs:
1. "The only valid attribute " diagnostic was capitalized.
2. Various diagnostics printed as ''labelname'' instead of 'labelname'
3. This reduces duplication of label checking between functions and blocks.

Review appreciated, particularly for the cindex and template bits.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125733 91177308-0d34-0410-b5e6-96231b3b80d8
tmt.stmt/stmt.label/p1.cpp
c6daf0b29d6c48a99cb1ad707973a7e6dfcafd58 17-Feb-2011 Douglas Gregor <dgregor@apple.com> When printing a qualified type, look through a substituted template
parameter type to see what's behind it, so that we don't end up
printing silly things like "float const *" when "const float *" would
make more sense. Also, replace the pile of "isa" tests with a simple
switch enumerating all of the cases, making a few more obvious cases
use prefix qualifiers.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125729 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.mem/p5.cpp
emp/temp.fct.spec/temp.deduct/temp.deduct.call/p3-0x.cpp
4bfd680597862e437fcba739dce58531d0b15d6e 15-Feb-2011 John McCall <rjmccall@apple.com> Handle delayed access in local declarations. PR9229.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125609 91177308-0d34-0410-b5e6-96231b3b80d8
lass.access/p6.cpp
b25b295fdfc443bdf060e860a21f6f01d9fbdc18 15-Feb-2011 John McCall <rjmccall@apple.com> Return a declaration to the parser when creating a field in C++ so that
the parser will complete the declarator with a valid decl and thus trigger
delayed diagnostics for it. It certainly looks like we were intentionally
returning null here, but I couldn't find any good reason for it, and there
wasn't a comment, so farewell to all that.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125556 91177308-0d34-0410-b5e6-96231b3b80d8
lass.access/p6.cpp
417d39f300da40067600863c2733fdeb513fb4d2 15-Feb-2011 John McCall <rjmccall@apple.com> Don't crash on hierarchy static_casts which appear in variable initializers.
PR9221.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125532 91177308-0d34-0410-b5e6-96231b3b80d8
lass.access/class.friend/p1.cpp
f5ba7e089daadcd60b0f6e31d932be8bb6045281 14-Feb-2011 John McCall <rjmccall@apple.com> Change the context correctly when instantiating a static data member definition.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125517 91177308-0d34-0410-b5e6-96231b3b80d8
lass.access/p4.cpp
79ab2c8104ef5df233d271560ccc734836738e56 14-Feb-2011 John McCall <rjmccall@apple.com> Provide overload diagnostics when explicit casts involving class types fail.
PR8626.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125506 91177308-0d34-0410-b5e6-96231b3b80d8
pecial/class.copy/p9.cpp
eee1d5434ebfa955ffc3c493aecd68bb7b3f4838 14-Feb-2011 John McCall <rjmccall@apple.com> When parsing an out-of-line member function declaration, we must delay
access-control diagnostics which arise from the portion of the declarator
following the scope specifier, just in case access is granted by
friending the individual method. This can also happen with in-line
member function declarations of class templates due to templated-scope
friend declarations.

We were really playing fast-and-loose before with this sort of thing,
and it turned out to work because *most* friend functions are in file
scope. Making us delay regardless of context exposed several bugs with
how we were manipulating delay. I ended up needing a concept of a
context that's independent of the declarations in which it appears,
and then I actually had to make some things save contexts correctly,
but delay should be much cleaner now.

I also encapsulated all the delayed-diagnostics machinery in a single
subobject of Sema; this is a pattern we might want to consider rolling
out to other components of Sema.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125485 91177308-0d34-0410-b5e6-96231b3b80d8
lass.access/class.friend/p1.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/expr.cast/p4.cpp
f677ea3cc9598d9952ad7ffab5fb322ba4c5be31 05-Feb-2011 Sebastian Redl <sebastian.redl@getdesigned.at> Basic implementation of inherited constructors. Only generates declarations, and probably only works for very basic use cases.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124970 91177308-0d34-0410-b5e6-96231b3b80d8
pecial/class.inhctor/elsewhere.cpp
pecial/class.inhctor/p3.cpp
pecial/class.inhctor/p7.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/expr.mptr.oper/p5.cpp
461bf2eb82981d00a014409126ef9c3538551a94 04-Feb-2011 Douglas Gregor <dgregor@apple.com> Tweak my fix for PR8748, and update the incorrect PR number in the test case.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124863 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.param/p9-0x.cpp
d89d86fe4acaa4782b0ed8a684bbc1b32cb48b70 04-Feb-2011 Douglas Gregor <dgregor@apple.com> Tighten up the semantics of default template arguments, per C++0x
[temp.param]p9 and C++ DR226. Fixes PR8747.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124856 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.param/p9-0x.cpp
ee5d21f63714459f39e0be28fec9dbecf0720505 04-Feb-2011 Douglas Gregor <dgregor@apple.com> When a function template's template parameter has a default argument,
it's okay for the following template parameters to not have default
arguments (since those template parameters can still be
deduced). Also, downgrade the error about default template arguments
in function templates to an extension warning, since this is a
harmless C++0x extension.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124855 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.param/p11-0x.cpp
emp/temp.param/p9.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
cl.dcl/basic.namespace/namespace.udecl/p1.cpp
xpr/expr.unary/expr.delete/p5.cpp
4867347e82648d3baf09524b98b09c297a5a198f 28-Jan-2011 Nico Weber <nicolasweber@gmx.de> PR9037: Allow override, final, and new as an extension on inline members.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124477 91177308-0d34-0410-b5e6-96231b3b80d8
lass/class.mem/p8-0x-pedantic.cpp
lass/class.mem/p8-0x.cpp
fd1a8fd240c8067e286e3881aac2bd8b700517d3 27-Jan-2011 Douglas Gregor <dgregor@apple.com> When we run into a template parameter that should have a default
argument but doesn't (because previous template parameters had default
arguments), clear out all of the default arguments so that we maintain
the invariant that a template parameter has a default argument only if
subsequence template parameters also have default arguments.
Fixes a crash-on-invalid <rdar://problem/8913649>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124345 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.param/p1.cpp
944aa60777e6ea1015c9423107f7925f6d91f4a0 27-Jan-2011 Douglas Gregor <dgregor@apple.com> Cope with parenthesized function declarators when emitting a
diagnostic about ref-qualifiers where they do not belong.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124344 91177308-0d34-0410-b5e6-96231b3b80d8
cl.decl/dcl.meaning/dcl.fct/p6-0x.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/expr.cast/p4.cpp
b145ee6cc7d7db42ca4351ff3fe91f04e86a2f67 26-Jan-2011 Douglas Gregor <dgregor@apple.com> Implement the restriction that a function with a ref-qualifier cannot
overload a function without a ref-qualifier (C++0x
[over.load]p2). This, apparently, completes the implementation of
rvalue references for *this.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124321 91177308-0d34-0410-b5e6-96231b3b80d8
ver/over.load/p2-0x.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/expr.cast/p4-0x.cpp
fcab48b626b7ce43625958e857061d721a43a5bc 26-Jan-2011 Douglas Gregor <dgregor@apple.com> Rvalue references for *this: explicitly keep track of whether a
reference binding is for the implicit object parameter of a member
function with a ref-qualifier. My previous comment, that we didn't
need to track this explicitly, was wrong: we do in fact get
rvalue-references-prefer-rvalues overloading with ref-qualifiers.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124313 91177308-0d34-0410-b5e6-96231b3b80d8
ver/over.match/over.match.funcs/p4-0x.cpp
2c9a03f3b249e4d9d76eadf758a33142adc4d0a4 26-Jan-2011 Douglas Gregor <dgregor@apple.com> Rvalue references for *this: implement the implicit conversion rules
for the implicit object argument to a non-static member function with
a ref-qualifier (C++0x [over.match.funcs]p4).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124311 91177308-0d34-0410-b5e6-96231b3b80d8
ver/over.match/over.match.funcs/p4-0x.cpp
57c9f4f278fe15dc4964f2999486ffdbabce635c 26-Jan-2011 Douglas Gregor <dgregor@apple.com> Rvalue references for *this: allow functions to be overloaded based on
the presence and form of a ref-qualifier. Note that we do *not* yet
implement the restriction in C++0x [over.load]p2 that requires either
all non-static functions with a given parameter-type-list to have a
ref-qualifier or none of them to have a ref-qualifier.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124297 91177308-0d34-0410-b5e6-96231b3b80d8
ver/over.load/p2-0x.cpp
e3c7a7ca66c02567543dbb5ec493818e00e8b177 26-Jan-2011 Douglas Gregor <dgregor@apple.com> Rvalue references for *this: tentative parsing and template argument deduction.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124295 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.fct.spec/temp.deduct/temp.deduct.type/p8-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/expr.mptr.oper/p6-0x.cpp
440a48318c53647d6416bcb1ff1af1452aa5d453 26-Jan-2011 Douglas Gregor <dgregor@apple.com> Reinstate r124236 (tweaking the rvalue-reference overload resolution
rules), now that we've actually have a clean build for me to sully.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124290 91177308-0d34-0410-b5e6-96231b3b80d8
ver/over.match/over.match.best/over.ics.rank/p3-0x.cpp
c938c1668b4fd12af154e965dd935a89e4801a70 26-Jan-2011 Douglas Gregor <dgregor@apple.com> Rvalue references for *this:

- Add ref-qualifiers to the type system; they are part of the
canonical type. Print & profile ref-qualifiers
- Translate the ref-qualifier from the Declarator chunk for
functions to the function type.
- Diagnose mis-uses of ref-qualifiers w.r.t. static member
functions, free functions, constructors, destructors, etc.
- Add serialization and deserialization of ref-qualifiers.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124281 91177308-0d34-0410-b5e6-96231b3b80d8
cl.decl/dcl.meaning/dcl.fct/p6-0x.cpp
pecial/class.ctor/p4-0x.cpp
pecial/class.dtor/p2-0x.cpp
83f51722ed2b8134810cb178f39e44da811de7cd 26-Jan-2011 Douglas Gregor <dgregor@apple.com> Rvalue references for *this: parse ref-qualifiers.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124276 91177308-0d34-0410-b5e6-96231b3b80d8
cl.decl/p4-0x.cpp
4d4feead7e240bf24264658b5abb0b88d52ed684 26-Jan-2011 Douglas Gregor <dgregor@apple.com> Speculatively revert r124236

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124247 91177308-0d34-0410-b5e6-96231b3b80d8
ver/over.match/over.match.best/over.ics.rank/p3-0x.cpp
b7cd135215501a154eb4f68159f3af020783099e 25-Jan-2011 Douglas Gregor <dgregor@apple.com> Speculatively implement a tweak to the C++0x overload resolution rules
for reference binding (C++ [over.rank.ics]p3b1sb4), so that we prefer
the binding of an lvalue reference to a function lvalue over the
binding of an rvalue reference. This change resolves the ambiguity
with std::forward and lvalue references to function types in a way
that seems consistent with the original rvalue references proposal.

My proposed wording for this change is shown in
isBetterReferenceBindingKind(); we'll try to get this change adopted
in the C++0x working paper as well.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124236 91177308-0d34-0410-b5e6-96231b3b80d8
ver/over.match/over.match.best/over.ics.rank/p3-0x.cpp
48a4ce7d484a448490edfe9e1d47b806cee85f30 25-Jan-2011 Douglas Gregor <dgregor@apple.com> Fix the ranking of reference bindings during overload resolution
(C++0x [over.ics.rank]p3) when one binding is an lvalue reference and
the other is an rvalue reference that binds to an rvalue. In
particular, we were using the predict "is an rvalue reference" rather
than "is an rvalue reference that binds to an rvalue", which was
incorrect in the one case where an rvalue reference can bind to an
lvalue: function references.

This particular issue cropped up with std::forward, where Clang was
picking an std::forward overload while forwarding an (lvalue)
reference to a function. However (and unfortunately!), the right
answer for this code is that the call to std::forward is
ambiguous. Clang now gets that right, but we need to revisit the
std::forward implementation in libc++.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124216 91177308-0d34-0410-b5e6-96231b3b80d8
ver/over.match/over.match.best/over.ics.rank/p3-0x.cpp
0691a5c83246604a89654e0dfc25870e742035b4 25-Jan-2011 Rafael Espindola <rafael.espindola@gmail.com> Move unnamed_addr after the function arguments on Sabre's request.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124210 91177308-0d34-0410-b5e6-96231b3b80d8
xcept/except.spec/p14-ir.cpp
73b3cf6503f72f054288cf474e1a8c8ae56383c2 25-Jan-2011 Douglas Gregor <dgregor@apple.com> Implement the rvalue-reference deduction transformation (from T&& ->
T) when taking the address of an overloaded function or matching a
specialization to a template (C++0x [temp.deduct.type]p10). Fixes
PR9044.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124197 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.fct.spec/temp.deduct/temp.deduct.type/p10-0x.cpp
8dde14e7f43a4b29e592b3e8e576eb467ddb6c6e 24-Jan-2011 Douglas Gregor <dgregor@apple.com> Re-instate r123977/r123978, my updates of the reference-binding
implementation used by overload resolution to support rvalue
references. The original commits caused PR9026 and some
hard-to-reproduce self-host breakage.

The only (crucial!) difference between this commit and the previous
commits is that we now properly check the SuppressUserConversions flag
before attempting to perform a second user-defined conversion in
reference binding, breaking the infinite recursion chain of
user-defined conversions.

Rvalue references should be working a bit better now.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124121 91177308-0d34-0410-b5e6-96231b3b80d8
cl.decl/dcl.init/dcl.init.ref/p5-0x.cpp
15e14a289583616e582a23b320933e846a742626 23-Jan-2011 Anders Carlsson <andersca@mac.com> Get rid of [[hiding]], [[override]] and [[base_check]].

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124087 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/dcl.attr/dcl.attr.override/p1.cpp
cl.dcl/dcl.attr/dcl.attr.override/p6.cpp
f89e0424b8903438179f4a2f16dddd5e5bdc814e 23-Jan-2011 Anders Carlsson <andersca@mac.com> Get rid of the [[final]] C++0x attribute.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124083 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/dcl.attr/dcl.attr.final/p4.cpp
aa23d288be658cca59d2e128954a50e9ada4ef27 22-Jan-2011 Anders Carlsson <andersca@mac.com> Implement [class.derived]p8.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124047 91177308-0d34-0410-b5e6-96231b3b80d8
lass.derived/p8-0x.cpp
7028088b4bce6fa4660232698068d4cc7b0ab698 22-Jan-2011 Anders Carlsson <andersca@mac.com> Mark classes final and/or explicit during class template instantiation.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124040 91177308-0d34-0410-b5e6-96231b3b80d8
lass/p2-0x.cpp
dfc2f1035d23e294b298766a3cf51dfe249d53a2 22-Jan-2011 Anders Carlsson <andersca@mac.com> Mark classes as final or explicit. Diagnose when a class marked 'final' is used as a base.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124039 91177308-0d34-0410-b5e6-96231b3b80d8
lass/p2-0x.cpp
cc54d594d4f6509c0e3a8e349e481d9b5d899df6 22-Jan-2011 Anders Carlsson <andersca@mac.com> Parse class-virt-specifier-seqs.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124036 91177308-0d34-0410-b5e6-96231b3b80d8
lass/p1-0x.cpp
aa5952c53f6c6a844a22fa2294186e16018b31e1 22-Jan-2011 Rafael Espindola <rafael.espindola@gmail.com> revert r123977 and r123978 to fix PR9026.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124033 91177308-0d34-0410-b5e6-96231b3b80d8
cl.decl/dcl.init/dcl.init.ref/p5-0x.cpp
f1602a56f89ac48aa1b5bce42f07ee795e674a6f 22-Jan-2011 Anders Carlsson <andersca@mac.com> A member function template cannot be virtual.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124031 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.mem/p3.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/expr.post/expr.const.cast/p1-0x.cpp
xpr/expr.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/expr.post/expr.dynamic.cast/p3-0x.cpp
xpr/expr.post/expr.static.cast/p3-0x.cpp
72dfa27b415b15157a9d1fc33b6ed21f0085bed2 21-Jan-2011 Douglas Gregor <dgregor@apple.com> When throwing an elidable object, first try to treat the subexpression
as an rvalue per C++0x [class.copy]p33. If that fails, try again with
the original subexpression.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124002 91177308-0d34-0410-b5e6-96231b3b80d8
pecial/class.copy/p33-0x.cpp
cc15f010672a13b38104a32e3cefc7adc07ffbf7 21-Jan-2011 Douglas Gregor <dgregor@apple.com> Implement the preference for move-construction over copy-construction
when returning an NRVO candidate expression. For example, this
properly picks the move constructor when dealing with code such as

MoveOnlyType f() { MoveOnlyType mot; return mot; }

The previously-XFAIL'd rvalue-references test case now works, and has
been moved into the appropriate paragraph-specific test case.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123992 91177308-0d34-0410-b5e6-96231b3b80d8
pecial/class.copy/p33-0x.cpp
b939a1987318f802fd25f89e15ae7d2423161cac 21-Jan-2011 Douglas Gregor <dgregor@apple.com> Implement core issue 1164, which concerns the partial ordering of
f(T&) and f(T&&).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123981 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.fct.spec/temp.deduct/temp.deduct.partial/p9-0x.cpp
b13ede9f440f52ccfce046f1eba98679e9ffc0e6 21-Jan-2011 Douglas Gregor <dgregor@apple.com> Add test for overload resolution's preference for binding an rvalue
reference to an rvalue rather than binding a const-qualified lvalue
reference to that rvalue.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123979 91177308-0d34-0410-b5e6-96231b3b80d8
ver/over.match/over.match.best/over.ics.rank/p3-0x.cpp
68ed68b227c25babfbdd38d9a5b4b423d501951f 21-Jan-2011 Douglas Gregor <dgregor@apple.com> Update the reference-binding implementation used for overload
resolution to match the latest C++0x working paper's semantics. The
implementation now matching up with the reference-binding
implementation used for initialization.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123977 91177308-0d34-0410-b5e6-96231b3b80d8
cl.decl/dcl.init/dcl.init.ref/p5-0x.cpp
dd0e023cf8faf95eb8025a02ce6fd19ef7788216 21-Jan-2011 Douglas Gregor <dgregor@apple.com> More testing to C++0x [temp.deduct.call]p3

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123967 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.fct.spec/temp.deduct/temp.deduct.call/p3-0x.cpp
2ad746aeb90e86cea7afaf552a02ae3f3b5ec859 21-Jan-2011 Douglas Gregor <dgregor@apple.com> Implement the special template argument deduction rule for T&& in a
call (C++0x [temp.deduct.call]p3).

As part of this, start improving the reference-binding implementation
used in the computation of implicit conversion sequences (for overload
resolution) to reflect C++0x semantics. It still needs more work and
testing, of course.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123966 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.fct.spec/temp.deduct/temp.deduct.call/p3-0x.cpp
00d66cce52cf027eac77591a9847f87dacf36995 21-Jan-2011 Douglas Gregor <dgregor@apple.com> Add more reference-binding examples from the C++0x working paper, all of which seem to be working fine

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123955 91177308-0d34-0410-b5e6-96231b3b80d8
cl.decl/dcl.init/dcl.init.ref/p5-0x.cpp
b2855ad68d93824faf47c09bbef90ba74157f0f4 21-Jan-2011 Douglas Gregor <dgregor@apple.com> More work to bring reference binding up to the latest C++0x
specification. In particular, an rvalue reference can bind to an
initializer expression that is an lvalue if the referent type and the
initializer expression type are not reference-related. This is a newer
formulation to the previous "rvalue references can never bind to
lvalues" rule.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123952 91177308-0d34-0410-b5e6-96231b3b80d8
cl.decl/dcl.init/dcl.init.ref/p5-0x.cpp
564cb06b1f010ab3c5e316ac79ba6cfdd72e9c1d 21-Jan-2011 Douglas Gregor <dgregor@apple.com> When performing reference binding via a conversion function, perform
type checking based on the actual reference type we're trying to bind
the result to, rather than stripping the reference.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123950 91177308-0d34-0410-b5e6-96231b3b80d8
cl.decl/dcl.init/dcl.init.ref/p5-0x.cpp
35e99fa40f1245cc554d8a26373e0486eb9c28f2 20-Jan-2011 Douglas Gregor <dgregor@apple.com> More tests for reference binding in the presence of rvalue
references. Note that we're currently failing reference binding to a
function lvalue.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123920 91177308-0d34-0410-b5e6-96231b3b80d8
cl.decl/dcl.init/dcl.init.ref/p5-0x.cpp
c5db24dfbc860a9fd1501c72f398bf6b6d5b6e0e 20-Jan-2011 Douglas Gregor <dgregor@apple.com> Start refactoring reference binding to more closely match the C++0x
working paper's structure. The only functional change here is that we
now handling binding to array rvalues, which we would previously reject.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123918 91177308-0d34-0410-b5e6-96231b3b80d8
cl.decl/dcl.init/dcl.init.ref/p5-0x.cpp
2e1c730167d2b978c66558c029d163ffe64b9656 20-Jan-2011 Anders Carlsson <andersca@mac.com> Diagnose when a virtual member function marked final is overridden.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123916 91177308-0d34-0410-b5e6-96231b3b80d8
lass.derived/class.virtual/p3-0x.cpp
69d831645f429d3b806d2ae220aee45ca44f8c6c 20-Jan-2011 Douglas Gregor <dgregor@apple.com> Add some tests for reference-collapsing and referencing binding
involving rvalue references, to start scoping out what is and what
isn't implemented. In the process, tweak some standards citations,
type desugaring, and teach the tentative parser about && in
ptr-operator.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123913 91177308-0d34-0410-b5e6-96231b3b80d8
cl.decl/dcl.init/dcl.init.ref/p5-0x.cpp
cl.decl/dcl.meaning/dcl.ref/p6-0x.cpp
9eefa229dfb71400a6bbee326420a7f0e2e91f1f 20-Jan-2011 Anders Carlsson <andersca@mac.com> When instantiating member functions, propagate whether the member function is marked 'final' and 'override'.

Also, call CheckOverrideControl when instantiating member functions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123900 91177308-0d34-0410-b5e6-96231b3b80d8
lass.derived/class.virtual/p3-0x.cpp
3ffe183448af7c543a208dd3313a49c83a3ad53e 20-Jan-2011 Anders Carlsson <andersca@mac.com> When checking for functions marked override, ignore dependent contexts.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123894 91177308-0d34-0410-b5e6-96231b3b80d8
lass.derived/class.virtual/p3-0x.cpp
9e682d9f567a51f26c3b0673837e23bafdb09c11 20-Jan-2011 Anders Carlsson <andersca@mac.com> Diagnose virtual member functions marked override but not overriding any virtual member functions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123888 91177308-0d34-0410-b5e6-96231b3b80d8
lass.derived/class.virtual/p3-0x.cpp
c7119a871df4d2d79db3e48fc9d0ab421be54a3d 20-Jan-2011 Anders Carlsson <andersca@mac.com> Fix tests to be valid.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123887 91177308-0d34-0410-b5e6-96231b3b80d8
lass/class.mem/p8-0x.cpp
98367f0322ac43fa5b0c7ccb33bab95f66b960f6 20-Jan-2011 Anders Carlsson <andersca@mac.com> Change the parser error to reflect that virt-specifiers are allowed on any class member.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123883 91177308-0d34-0410-b5e6-96231b3b80d8
lass/class.mem/p8-0x.cpp
aae5af24f031ad5f17872bd8b27ed5c175c0f90c 20-Jan-2011 Anders Carlsson <andersca@mac.com> Only allow virtual member functions to be marked 'override' and 'final'.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123882 91177308-0d34-0410-b5e6-96231b3b80d8
lass/class.mem/p8-0x.cpp
83eecbefa4931b95231c9f2a61fb7b9b15e00eec 20-Jan-2011 Douglas Gregor <dgregor@apple.com> When building a user-defined conversion sequence, keep track of the
declaration that name lookup actually found, so that we can use it for
access checking later on. Fixes <rdar://problem/8876150>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123867 91177308-0d34-0410-b5e6-96231b3b80d8
lass.access/p4.cpp
dfc331e04d4c6a09fb693a15fc5a57d29a198c86 20-Jan-2011 Douglas Gregor <dgregor@apple.com> Explicitly track the number of call arguments provided when performing
overload resolution, so that we only use that number of call arguments
for partial ordering. Fixes PR9006, a recent regression.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123861 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.fct.spec/temp.deduct/temp.deduct.partial/p11.cpp
a779d9ca2fdf1247f65de0e6acf2870d8be53ccd 19-Jan-2011 Douglas Gregor <dgregor@apple.com> Implement basic support for the use of variadic templates and blocks
together. In particular:
- Handle the use of captured parameter pack names within blocks
(BlockDeclRefExpr understands parameter packs now)
- Handle the declaration and expansion of parameter packs within a block's
parameter list, e.g., ^(Args ...args) { ... })
- Handle instantiation of blocks where the return type was not
explicitly specified. (unrelated, but necessary for my tests).

Together, these fixes should make blocks and variadic templates work
reasonably well together. Note that BlockDeclRefExpr is still broken
w.r.t. its computation of type and value dependence, which will still
cause problems for blocks in templates.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123849 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.variadic/ext-blocks.cpp
6952f1e4256c5b43aee5e98cea4e9b663bd1d413 19-Jan-2011 Douglas Gregor <dgregor@apple.com> Implement support for non-type template parameter packs whose type is
a pack expansion, e.g., the parameter pack Values in:

template<typename ...Types>
struct Outer {
template<Types ...Values>
struct Inner;
};

This new implementation approach introduces the notion of an
"expanded" non-type template parameter pack, for which we have already
expanded the types of the parameter pack (to, say, "int*, float*",
for Outer<int*, float*>) but have not yet expanded the values. Aside
from creating these expanded non-type template parameter packs, this
patch updates template argument checking and non-type template
parameter pack instantiation to make use of the appropriate types in
the parameter pack.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123845 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.variadic/multi-level-substitution.cpp
b971dbdb65149a7cf0c046380186d0204e5b411e 17-Jan-2011 Anders Carlsson <andersca@mac.com> Change ParseOptionalCXX0XVirtSpecifierSeq to take a VirtSpecifiers struct.

Enforce C++[class.mem]p8:
A virt-specifier-seq shall contain at most one of each virt-specifier.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123611 91177308-0d34-0410-b5e6-96231b3b80d8
lass/class.mem/p8-0x.cpp
9da95e6eefc4b0ca25e18bdab1b703f5c185deab 16-Jan-2011 Douglas Gregor <dgregor@apple.com> Tweak the partial ordering rules for function templates to prefer a
non-variadic function template over a variadic one. This matches GCC
and the intent of the C++0x wording, in a way that I think is likely
to be acceptable to the committee.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123581 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.variadic/partial-ordering.cpp
1aee05d08b2184acadeb36de300e216390780d6c 15-Jan-2011 Douglas Gregor <dgregor@apple.com> Introduce a new kind of TemplateName that captures a substituted
template template parameter pack that cannot be fully expanded because
its enclosing pack expansion could not be expanded. This form of
TemplateName plays the same role as SubstTemplateTypeParmPackType and
SubstNonTypeTemplateParmPackExpr do for template type parameter packs
and non-type template parameter packs, respectively.

We should now handle these multi-level pack expansion substitutions
anywhere. The largest remaining gap in our variadic-templates support
is that we cannot cope with non-type template parameter packs whose
type is a pack expansion.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123521 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.variadic/multi-level-substitution.cpp
c7793c73ba8a343de3f2552d984851985a46f159 15-Jan-2011 Douglas Gregor <dgregor@apple.com> Introduce a new expression kind, SubstNonTypeTemplateParmPackExpr,
that captures the substitution of a non-type template argument pack
for a non-type template parameter pack within a pack expansion that
cannot be fully expanded. This follows the approach taken by
SubstTemplateTypeParmPackType.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123506 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.variadic/multi-level-substitution.cpp
2be29f423acad3bbe39099a78db2805acb5bdf17 15-Jan-2011 Douglas Gregor <dgregor@apple.com> Teach template template argument pack expansions to keep track of the
number of expansions, when we know it, and propagate that information
through Sema.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123493 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.variadic/multi-level-substitution.cpp
6a24bfda084f06a0b252b7befe8cbb17fce7f94e 14-Jan-2011 Douglas Gregor <dgregor@apple.com> Handle substitutions into function parameter packs whose patterns
contain multiple parameter packs at different levels.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123488 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.variadic/multi-level-substitution.cpp
67fd1251aad51bb80d050b7fa5e506fef0ec8e02 14-Jan-2011 Douglas Gregor <dgregor@apple.com> Teach PackExpansionExpr to keep track of the number of pack expansions
it will expand to, if known. Propagate this information throughout Sema.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123470 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.variadic/multi-level-substitution.cpp
07a77b4b1d1fa95930129541eff8b79558f5d80d 14-Jan-2011 Douglas Gregor <dgregor@apple.com> When we're instantiating a direct variable initializer that has a pack
expansion in it, we may end up instantiating to an empty
expression-list. In this case, the variable is uninitialized; tweak
the instantiation logic to handle this case. Fixes PR8977.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123449 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.variadic/p4.cpp
cded4f649cd4b7ba7d461c25c6482ef52b8d3a2a 14-Jan-2011 Douglas Gregor <dgregor@apple.com> Keep track of the number of expansions to be produced from a type pack
expansion, when it is known due to the substitution of an out
parameter pack. This allows us to properly handle substitution into
pack expansions that involve multiple parameter packs at different
template parameter levels, even when this substitution happens one
level at a time (as with partial specializations of member class
templates and the signatures of member function templates).

Note that the diagnostic we provide when there is an arity mismatch
between an outer parameter pack and an inner parameter pack in this
case isn't as clear as the normal diagnostic for an arity
mismatch. However, this doesn't matter because these cases are very,
very rare and (even then) only typically occur in a SFINAE context.

The other kinds of pack expansions (expression, template, etc.) still
need to support optional tracking of the number of expansions, and we
need the moral equivalent of SubstTemplateTypeParmPackType for
substituted argument packs of template template and non-type template
parameters.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123448 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.variadic/multi-level-substitution.cpp
c3069d618f4661d923cb1b5c4525b082fce73b04 14-Jan-2011 Douglas Gregor <dgregor@apple.com> Start implementing support for substitution into pack expansions that
involve template parameter packs at multiple template levels that
occur within the signatures members of class templates (and partial
specializations thereof). This is a work-in-progress that is deficient
in several ways, notably:
- It only works for template type parameter packs, but we need to
also support non-type template parameter packs and template template
parameter packs.
- It doesn't keep track of the lengths of the substituted argument
packs in the expansion, so it can't properly diagnose length
mismatches.

However, this is a concrete step in the right direction.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123425 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.variadic/multi-level-substitution.cpp
c421f546e63b2f85caa1ca0d94d508f99bb871cb 13-Jan-2011 Douglas Gregor <dgregor@apple.com> Only apply the parameter pack matching of C++0x [temp.arg.template]p3
when we're actually matching a template template argument to a
template template parameter. Otherwise, use strict matching.

Fixes <rdar://problem/8859985> clang++: variadics and out-of-line definitions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123385 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.variadic/parameter-matching.cpp
4f1d282d6f32a419e89ddb56342e2313b0c78bb7 13-Jan-2011 Douglas Gregor <dgregor@apple.com> Allow us to transform pack expansion expressions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123349 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.variadic/injected-class-name.cpp
a03478231363c67ea0e1f4bc1bc708e064040e56 13-Jan-2011 Douglas Gregor <dgregor@apple.com> Implement C++0x [temp.arg.template]p3, which allows slightly fuzzy
matching of variadic template template parameters to template
arguments. This paragraph was the subject of ISO C++ committee
document N2555: Extending Variadic Template Template Parameters.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123348 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.arg/temp.arg.template/p3-0x.cpp
emp/temp.decls/temp.variadic/metafunctions.cpp
ac6c09917eaf32a35d2c7c95856864d877ef1963 12-Jan-2011 Douglas Gregor <dgregor@apple.com> Add some more partial-ordering tests, including one that changes with
the proposed resolution to core isue 692. I'm not certain which way
we'll go on this one.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123331 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.variadic/partial-ordering.cpp
2fc1bb76e719d0620b4a6e2134413933b21ca6b6 12-Jan-2011 Douglas Gregor <dgregor@apple.com> Teach TreeTransform how to transform a pack expansion type into
another pack expansion type. This can happen when rebuilding types in
the current instantiation.

Fixes <rdar://problem/8848837> (Clang crashing on libc++ <functional>).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123316 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.variadic/injected-class-name.cpp
77d6bb9e223496aa5288294f34e7225d1f65dddc 11-Jan-2011 Douglas Gregor <dgregor@apple.com> Implement partial ordering of class template partial specializations
and function templates that contain variadic templates. This involves
three small-ish changes:

(1) When transforming a pack expansion, if the transformed argument
still contains unexpanded parameter packs, build a pack
expansion. This can happen during the substitution that occurs into
class template partial specialiation template arguments during
partial ordering.

(2) When performing template argument deduction where the argument
is a pack expansion, match against the pattern of that pack
expansion.

(3) When performing template argument deduction against a non-pack
parameter, or a non-expansion template argument, deduction fails if
the argument itself is a pack expansion (C++0x
[temp.deduct.type]p22).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123279 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.variadic/partial-ordering.cpp
emp/temp.fct.spec/temp.deduct/temp.deduct.partial/p12.cpp
emp/temp.fct.spec/temp.deduct/temp.deduct.type/p22.cpp
4e97586b804f6132d83cb534f16a5b6a7756e819 11-Jan-2011 Douglas Gregor <dgregor@apple.com> Add another test for [temp.func.order]p5/[temp.deduct.partial]p11,
from James Widman.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123245 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.fct.spec/temp.deduct/temp.deduct.partial/p11.cpp
5c7bf42ef16dc767615bed10f3b7b3c1265314e1 11-Jan-2011 Douglas Gregor <dgregor@apple.com> Implement C++ [temp.func.order]p5 more directly, by passing down the
number of explicit call arguments. This actually fixes an erroneous
test for [temp.deduct.partial]p11, where we were considering
parameters corresponding to arguments beyond those that were
explicitly provided.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123244 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.fct.spec/temp.deduct/temp.deduct.partial/p11.cpp
2e996d929d2593e5131640e774d04fe433ba5f89 11-Jan-2011 Douglas Gregor <dgregor@apple.com> Add example from C++0x [temp.deduct.type]p21, which already works

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123237 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.fct.spec/temp.deduct/temp.deduct.type/p21.cpp
21371ea7cf647f4f0f783faac325925cb8febb1c 11-Jan-2011 Douglas Gregor <dgregor@apple.com> When mapping from a function parameter pack to the set of function
parameters it expanded to, map exactly the number of function
parameters that were expanded rather than just running to the end of
the instantiated parameter list. This finishes the implementation of
the last sentence of C++0x [temp.deduct.call]p1.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123213 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.fct.spec/temp.deduct/temp.deduct.call/p1-0x.cpp
7d5c0c1273bdc1cb3dff1cb5a62d07b1439e82c7 11-Jan-2011 Douglas Gregor <dgregor@apple.com> Implement the last bullet of [temp.deduct.type]p5 and part of the last
sentence of [temp.deduct.call]p1, both of which concern the
non-deducibility of parameter packs not at the end of a
parameter-type-list. The latter isn't fully implemented yet; see the
new FIXME.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123210 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.fct.spec/temp.deduct/temp.deduct.call/p1-0x.cpp
emp/temp.fct.spec/temp.deduct/temp.deduct.type/p5-0x.cpp
4f3018eceac9cc32966e50ee900d8559efcaea21 11-Jan-2011 Douglas Gregor <dgregor@apple.com> Make sure that we parse a '>>' that closes two template argument lists
appropritely when there are no other template arguments.




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123204 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.param/p15-cxx0x.cpp
10ffc00e2177f042808f507c8dd50b744ed6f738 11-Jan-2011 Douglas Gregor <dgregor@apple.com> Add testing for unexpanded parameter packs in all of the C++
expression kinds. This is (indirectly) a test verifying that the
recursive AST visitor is visiting the children of these expression
nodes.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123198 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.variadic/p5.cpp
c5f657fe308f22243f674fc1dfbe24915944d8bf 11-Jan-2011 Rafael Espindola <rafael.espindola@gmail.com> Add unnamed_addr to constructors and destructors.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123197 91177308-0d34-0410-b5e6-96231b3b80d8
xcept/except.spec/p14-ir.cpp
3cae5c9a79bfd2e27eb44c32b13dfacd2ce5c66f 10-Jan-2011 Douglas Gregor <dgregor@apple.com> Implement more of C++0x [temp.arg.explicit]p9, allowing extension of
pack expansions in template argument lists and function parameter
lists. The implementation of this paragraph should be complete
*except* for cases where we're substituting into one of the unexpanded
packs in a pack expansion; that's a general issue I haven't solved yet.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123188 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.fct.spec/temp.arg.explicit/p9-0x.cpp
d3731198193eee92796ddeb493973b7a598b003e 10-Jan-2011 Douglas Gregor <dgregor@apple.com> Work-in-progress implementation of C++0x [temp.arg.explicit]p9, which
allows an argument pack determines via explicit specification of
function template arguments to be extended by further, deduced
arguments. For example:

template<class ... Types> void f(Types ... values);
void g() {
f<int*, float*>(0, 0, 0); // Types is deduced to the sequence int*, float*, int
}

There are a number of FIXMEs in here that indicate places where we
need to implement + test retained expansions, plus a number of other
places in deduction where we need to correctly cope with the
explicitly-specified arguments when deducing an argument
pack. Furthermore, it appears that the RecursiveASTVisitor needs to be
auditied; it's missing some traversals (especially w.r.t. template
arguments) that cause it not to find unexpanded parameter packs when
it should.

The good news, however, is that the tr1::tuple implementation now
works fully, and the tr1::bind example (both from N2080) is actually
working now.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123163 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.variadic/example-bind.cpp
emp/temp.decls/temp.variadic/example-tuple.cpp
emp/temp.fct.spec/temp.arg.explicit/p9-0x.cpp
e8bbf98ba4a388d89d1b4da9e15aabedf8eb53a6 07-Jan-2011 Douglas Gregor <dgregor@apple.com> Variadic templates example: a nearly-complete implementation of a TR1
function class template.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123024 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.variadic/example-function.cpp
emp/temp.decls/temp.variadic/example-tuple.cpp
03414b98caba86771622c35b1fa70d13de0c14ba 07-Jan-2011 Douglas Gregor <dgregor@apple.com> Variadic templates example: a nearly-complete implementation of a TR1
tuple class template. This implementation is boosted directly from the
variadic templates proposal. N2080.

Note that one section is #ifdef'd out. I'll implement that aspect of
template argument deduction next.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123016 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.variadic/example-tuple.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/expr.unary/expr.sizeof/p5-0x.cpp
emp/temp.decls/temp.variadic/p2.cpp
emp/temp.decls/temp.variadic/p5.cpp
a009b59fc2c550a229b9146aabda8e33fe3a7771 07-Jan-2011 Douglas Gregor <dgregor@apple.com> Factor out the template transformation of a sequence of function
parameters into parameter types, so that substitution of
explicitly-specified function template arguments uses the same
path. This enables the use of explicitly-specified function template
arguments with variadic templates.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122986 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.fct.spec/temp.arg.explicit/p9-0x.cpp
f5c65ffbd7374b6c8d9f1e361041578640cab320 06-Jan-2011 Douglas Gregor <dgregor@apple.com> Implement template argument deduction from a call to a function
template whose last parameter is a parameter pack. This allows us to
form a call to, e.g.,

template<typename ...Args1, typename ...Args2>
void f(std::pair<Args1, Args2> ...pairs);

given zero or more instances of "pair".



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122973 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.fct.spec/temp.deduct/temp.deduct.call/p1-0x.cpp
603cfb4da2f7ba08a1c3452c2fbf70585b8e7621 06-Jan-2011 Douglas Gregor <dgregor@apple.com> Initial implementation of function parameter packs. This implementation allows:

1) Declaration of function parameter packs
2) Instantiation of function parameter packs within function types.
3) Template argument deduction of function parameter packs when
matching two function types.

We're missing all of the important template-instantiation logic for
function template definitions, along with template argument deduction
from the argument list of a function call, so don't even think of
trying to use these for real yet.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122926 91177308-0d34-0410-b5e6-96231b3b80d8
cl.decl/dcl.meaning/dcl.fct/p13.cpp
cl.decl/dcl.meaning/dcl.fct/p14.cpp
emp/temp.decls/temp.variadic/metafunctions.cpp
d53e16abd1dcaa2942d5183f48e7f63d0e75b35a 05-Jan-2011 Douglas Gregor <dgregor@apple.com> When we're converting deduced template arguments to the type of the
corresponding template parameter, make sure that prior converted
template arguments are available for substitution.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122902 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.variadic/metafunctions.cpp
a7fc901a2e39bfe55bfcff5934b2d9fdf9656491 05-Jan-2011 Douglas Gregor <dgregor@apple.com> Replace the representation of template template argument pack
expansions with something that is easier to use correctly: a new
template argment kind, rather than a bit on an existing kind. Update
all of the switch statements that deal with template arguments, fixing
a few latent bugs in the process. I"m happy with this representation,
now.

And, oh look! Template instantiation and deduction work for template
template argument pack expansions.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122896 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.variadic/metafunctions.cpp
emp/temp.decls/temp.variadic/p4.cpp
ba68eca7582a62e3e2ff4b0eba1b2b73a6b80895 05-Jan-2011 Douglas Gregor <dgregor@apple.com> Add semantic analysis for the creation of and an AST representation
for template template argument pack expansions. This allows fun such
as:

template<template<class> class ...> struct apply_impl { /*...*/ };
template<template<class> class ...Metafunctions> struct apply {
typedef typename apply_impl<Metafunctions...>::type type;
};

However, neither template argument deduction nor template
instantiation is implemented for template template argument packs, so
this functionality isn't useful yet.

I'll probably replace the encoding of template template
argument pack expansions in TemplateArgument so that it's harder to
accidentally forget about the expansion. However, this is a step in
the right general direction.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122890 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.param/p11-0x.cpp
1ed64765624d6f5226dd213e220e038b459972d1 05-Jan-2011 Douglas Gregor <dgregor@apple.com> Implement C++0x [temp.param]p11 for non-type and template template
parameter packs. Also, the "no template parameters after a template
parameter pack" rule only applies to primary class templates.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122877 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.param/p11-0x.cpp
f457c1a0a46d11623c3d4594b57dff7f5a1151da 05-Jan-2011 Douglas Gregor <dgregor@apple.com> Implement proper parameter pack matching for non-type template
parameters and template template parameters.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122875 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.variadic/parameter-matching.cpp
61c4d28e36cd3f1be392cb77f07436d1fa6b0f9f 05-Jan-2011 Douglas Gregor <dgregor@apple.com> Implement support for template template parameter packs, e.g.,

template<template<class> class ...Metafunctions>
struct apply_to_each;



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122874 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.variadic/metafunctions.cpp
emp/temp.decls/temp.variadic/p5.cpp
emp/temp.decls/temp.variadic/parameter-matching.cpp
emp/temp.param/p9-0x.cpp
54c53cca105ed595e12fecf04e415c3712bda936 05-Jan-2011 Douglas Gregor <dgregor@apple.com> Improve our handling of non-type template parameters in partial
specializations. We weren't dealing with any of the cases where the
type of the non-type template argument differs from the type of the
corresponding template parameter in the primary template. We would
think that the template parameter in the partial specialization was
not deducible (and warn about it, incorrectly), then fail to convert a
deduced parameter to the type of the template parameter in the partial
specialization (which may involve truncation, among other
things). Fixes PR8905.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122851 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.class.spec/p9.cpp
emp/temp.decls/temp.variadic/deduction.cpp
b9a7d6fb53f2b76df2ef832146a1edb4cb01b9f6 04-Jan-2011 Douglas Gregor <dgregor@apple.com> Improve the checking of deduced template arguments stored within template argument packs when finishing template argument deduction for a function template

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122843 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.variadic/deduction.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/expr.unary/expr.sizeof/p5-0x.cpp
b2b5cc0cf908d516a107d373db963f692449a8a8 04-Jan-2011 Chandler Carruth <chandlerc@gmail.com> Enhance the diagnostic for negative array sizes to include the
declaration name of the array when present. This ensures that
a poor-man's C++03 static_assert will include the user error message
often embedded in the name.

Update all the tests to reflect the new wording, and add a test for the
name behavior.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122802 91177308-0d34-0410-b5e6-96231b3b80d8
cl.decl/dcl.meaning/dcl.array/p1.cpp
b95cc97b2023d00cd3fbae8455bc9d728eab5e5d 04-Jan-2011 Douglas Gregor <dgregor@apple.com> When creating the injected-class-name for a class template involving a
non-type template parameter pack, make sure to create a pack expansion
for the corresponding template argument.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122799 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.variadic/metafunctions.cpp
3fb9e4b89f72823f162096086f0f964e6dcf66d6 04-Jan-2011 Douglas Gregor <dgregor@apple.com> Implement pack expansion of base initializers, so that we can
initialize those lovely mixins that come from pack expansions of base
specifiers.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122793 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.variadic/p4.cpp
f90b27ad077c3339b62befc892382845339f9490 03-Jan-2011 Douglas Gregor <dgregor@apple.com> Implement pack expansions whose pattern is a base-specifier.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122782 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.variadic/p4.cpp
69e5aed635946419d85a6be8639260e2eb476cb1 03-Jan-2011 Douglas Gregor <dgregor@apple.com> Add a test that is currently failing

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122780 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.variadic/metafunctions.cpp
7a21fd45d4f04643cbfb5df96a01f84bc6d3dd14 03-Jan-2011 Douglas Gregor <dgregor@apple.com> Properly rebuild pack expansions whose pattern is a non-type template
argument. As part of this, be more careful when determining if there
are any parameter packs that cannot be expanded.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122776 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.variadic/multi-level-substitution.cpp
emp/temp.decls/temp.variadic/p5.cpp
bacb9493770ff19cfd8f7bc46a075f14b4d08159 03-Jan-2011 Douglas Gregor <dgregor@apple.com> Unwrap template argument packs when checking the template arguments of
a class template partial specialiation, and look through pack
expansions when checking the conditions of C++0x [temp.class.spec]p8.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122774 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.class.spec/p8-0x.cpp
925910d488051cbd4e38f350c1e9d69c473f09a0 03-Jan-2011 Douglas Gregor <dgregor@apple.com> Diagnose the presence of unexpanded parameter packs within class
template partial specialization arguments.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122769 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.variadic/p5.cpp
dcaa1ca0b475dfa887e1d061678a1e3501288510 03-Jan-2011 Douglas Gregor <dgregor@apple.com> Implement support for pack expansions in initializer lists and
expression lists.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122764 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.variadic/p4.cpp
dee196ef31073b40c48d60d9fa626ee1d8daaaee 03-Jan-2011 Douglas Gregor <dgregor@apple.com> Another variadic template metafunction test case: summing values.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122752 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.variadic/metafunctions.cpp
be230c36e32142cbdcdbe9c97511d097beeecbab 03-Jan-2011 Douglas Gregor <dgregor@apple.com> Implement support for pack expansions whose pattern is a non-type
template argument (described by an expression, of course). For
example:

template<int...> struct int_tuple { };

template<int ...Values>
struct square {
typedef int_tuple<(Values*Values)...> type;
};

It also lays the foundation for pack expansions in an initializer-list.




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122751 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.variadic/metafunctions.cpp
81063a237722ae010bca325021b92436f8c56e05 03-Jan-2011 Douglas Gregor <dgregor@apple.com> Consolidate template metafunction tests for variadic templates into a single file

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122748 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.variadic/count.cpp
emp/temp.decls/temp.variadic/metafunctions.cpp
emp/temp.decls/temp.variadic/replace.cpp
6e4e17de3df88ead7eaf51b3503a6be1718438c0 24-Dec-2010 Douglas Gregor <dgregor@apple.com> Fix a thinko in a helper routine for template argument deduction that
caused an assertion when dealing with non-type template parameter
packs. Add some tests for deduction and instantiation of non-type
template parameter packs.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122534 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.fct.spec/temp.deduct/temp.deduct.type/p9-0x.cpp
85374738e40a3b5bf078d05787e8fa96fa63c2d0 24-Dec-2010 Douglas Gregor <dgregor@apple.com> Non-type template parameter packs cannot have default arguments.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122533 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.param/p9-0x.cpp
56bc9832bc8f80604bfddc2c93f81537df6930a1 24-Dec-2010 Douglas Gregor <dgregor@apple.com> When instantiating a non-type template parameter pack, be sure to
extract the appropriate argument from the argument pack (based on the
current substitution index, of course). Simple instantiation of pack
expansions involving non-type template parameter packs now works.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122532 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.variadic/p4.cpp
10738d36b150aa65206890c1c845cdba076e4200 24-Dec-2010 Douglas Gregor <dgregor@apple.com> Add an AST representation for non-type template parameter
packs, e.g.,

template<typename T, unsigned ...Dims> struct multi_array;

along with semantic analysis support for finding unexpanded non-type
template parameter packs in types, expressions, and so on.

Template instantiation involving non-type template parameter packs
probably doesn't work yet. That'll come soon.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122527 91177308-0d34-0410-b5e6-96231b3b80d8
cl.decl/dcl.meaning/dcl.fct/p13.cpp
emp/temp.decls/temp.variadic/p5.cpp
a8bc8c9e9ba5bffebde00340786fe8542469c435 23-Dec-2010 Douglas Gregor <dgregor@apple.com> Implement parsing of function parameter packs and non-type template
parameter packs (C++0x [dcl.fct]p13), including disambiguation between
unnamed function parameter packs and varargs (C++0x [dcl.fct]p14) for
cases like

void f(T...)

where T may or may not contain unexpanded parameter packs.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122520 91177308-0d34-0410-b5e6-96231b3b80d8
cl.decl/dcl.meaning/dcl.fct/p13.cpp
cl.decl/dcl.meaning/dcl.fct/p14.cpp
b9c6631941619fb8c74f1056fbc56270629201c1 23-Dec-2010 Douglas Gregor <dgregor@apple.com> Reimplement the comparison of a class template partial
specialization's template arguments against the primary template's
template arguments using the obvious, correct method of checking the
injected-class-name type (C++ [temp.class.spec]p9b3). The previous
incarnation of this comparison attempted to use its own formulation of
the injected-class-name, which is redudant and, with the introduction
of variadic templates, became wrong (again).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122508 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.class.spec/p9-0x.cpp
b7d09d627c8576b9bc85f44f05befdd44fedc7ed 23-Dec-2010 Douglas Gregor <dgregor@apple.com> When forming the injected-class-name of a variadic template, the
template argument corresponding to a template parameter pack is an
argument pack of a pack expansion of that template parameter
pack. Implements C++0x [temp.dep.type]p2 (at least, as much of it as
we can).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122498 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.variadic/injected-class-name.cpp
ea6c96f63a45b4ffdcdf9824a9cf31a32825c0f6 23-Dec-2010 Douglas Gregor <dgregor@apple.com> Implement the part of C++0x [temp.arg.explicit]p3 that pertains to
parameter packs. In particular, a parameter pack not otherwise deduced
is deduced to an empty parameter pack.

The C++0x wording here is a bit unfortunate; this should really only
apply to function templates, and it mentions "trailing" parameter
packs, which doesn't really make sense in the context of function
templates. Will file a core issue separately.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122463 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.fct.spec/temp.arg.explicit/p3-0x.cpp
7b976ece336d209977b25b5c28ee09c2d2146e6a 23-Dec-2010 Douglas Gregor <dgregor@apple.com> Implement the rest of C++0x [temp.deduct.type]p9, which specifies that
the presence of a pack expansion anywhere except at the end of a
template-argument-list causes the entire template-argument-list to be
a non-deduced context.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122461 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.fct.spec/temp.deduct/temp.deduct.type/p2-0x.cpp
emp/temp.fct.spec/temp.deduct/temp.deduct.type/p9-0x.cpp
0d80abc3b7fb0dca26fb6b272d2c3484f86fb7e7 23-Dec-2010 Douglas Gregor <dgregor@apple.com> Unify the consistency checking for deduced template arguments into a
single routine. Extend that routine to handle consistency
checking for template argument packs, so that we can compare the
deduced packs for template parameter packs across different pack
expansions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122452 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.fct.spec/temp.deduct/temp.deduct.type/p2-0x.cpp
e02e26293cf8e3bad1059b39cea75c6582896da6 22-Dec-2010 Douglas Gregor <dgregor@apple.com> Implement template argument deduction for pack expansions whose
pattern is a template argument, which involves repeatedly deducing
template arguments using the pattern of the pack expansion, then
bundling the resulting deductions into an argument pack.

We can now handle a variety of simple list-handling metaprograms using
variadic templates. See, e.g., the new "count" metaprogram.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122439 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.variadic/count.cpp
0972c867e72171f24052d7b6d307020c065f8a66 22-Dec-2010 Douglas Gregor <dgregor@apple.com> When performing template argument deduction where the argument is a
dependent template specialization type, the number of template
arguments need not match precisely. Rather than checking the number of
arguments eagerly (which does not consider argument packs), let the
deduction routine for template argument lists cope with too many/too
few arguments.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122425 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.variadic/replace.cpp
20a55e2515ce89ddf9993941f9b5d0f3a6c91b4f 22-Dec-2010 Douglas Gregor <dgregor@apple.com> Implicitly expand argument packs when performing template argument
deduction. Unify all of the looping over template arguments for
deduction purposes into a single place, where argument pack expansion
occurs; this is also the hook for deducing from pack expansions, which
itself is not yet implemented.

For now, at least we can handle a basic "count" metafunction written
with variadics. See the new test for the formulation that works.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122418 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.variadic/count.cpp
55dc95b69846fde1c41aff7e2f3fcfed5d6fc5ab 21-Dec-2010 Douglas Gregor <dgregor@apple.com> Add test for C++ [temp.friend]p8, which bans partial specializations from being friends

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122335 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.friend/p8.cpp
124b3def9ed99dc844225aeb6b17f789307500ee 21-Dec-2010 Chris Lattner <sabre@nondot.org> add missing newlines at end of file.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122309 91177308-0d34-0410-b5e6-96231b3b80d8
tmt.stmt/stmt.select/p3.cpp
b99268b3083c882103bd1bd08bdcc9a76a2b4795 21-Dec-2010 Douglas Gregor <dgregor@apple.com> Implement instantiation of pack expansions whose pattern is a type-id
in an exception specification.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122297 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.variadic/p4.cpp
a04426c5416f22df1078f6b31c1619de73c40b59 21-Dec-2010 Douglas Gregor <dgregor@apple.com> Extend the parser to support pack expansions within exception
specifications. We can't yet instantiate them, however, since I
tripped over PR8835.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122292 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.variadic/p4.cpp
88f30dee6ca6d99e46d4ce61f691fb3dff4ae7c8 20-Dec-2010 Douglas Gregor <dgregor@apple.com> Test template instantiation of pack expansions where the parameter pack is in a nested-name-specifier

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122282 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.variadic/p4.cpp
dace95b13e2ceb0c3ec8de6babd926dc5114e1e5 20-Dec-2010 Douglas Gregor <dgregor@apple.com> Clean up the printing of template argument packs; previously, we were
getting extra "<>" delimiters around template argument packs.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122280 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.variadic/p4.cpp
emp/temp.decls/temp.variadic/p5.cpp
8491ffe86c50241b47c6d7ef8cd9ee00f5e675da 20-Dec-2010 Douglas Gregor <dgregor@apple.com> Implement basic support for template instantiation of pack expansions
whose patterns are template arguments. We can now instantiate, e.g.,

typedef tuple<pair<OuterTypes, InnerTypes>...> type;

where OuterTypes and InnerTypes are template type parameter packs.

There is a horrible inefficiency in
TemplateArgumentLoc::getPackExpansionPattern(), where we need to
create copies of TypeLoc data because our interfaces traffic in
TypeSourceInfo pointers where they should traffic in TypeLocs
instead. I've isolated in efficiency in this one routine; once we
refactor our interfaces to traffic in TypeLocs, we can eliminate it.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122278 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.variadic/p4.cpp
emp/temp.decls/temp.variadic/p5.cpp
14be16b93941aa4c4909b596d52a34af70ee1928 20-Dec-2010 Douglas Gregor <dgregor@apple.com> When checking a template argument list against a template containing
a parameter pack, check the parameter pack against each of the
template arguments it corresponds to, then pack the converted
arguments into a template argument pack. Allows us to use variadic
class templates so long as instantiation isn't required, e.g.,

template<typename... Types> struct Tuple;
Tuple<int, float> *t2;



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122251 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.variadic/p1.cpp
7536dd5e6c99584481b7dab68b7e7d8df9c54054 20-Dec-2010 Douglas Gregor <dgregor@apple.com> Introduce a new type, PackExpansionType, to capture types that are
pack expansions, e.g. given

template<typename... Types> struct tuple;

template<typename... Types>
struct tuple_of_refs {
typedef tuple<Types&...> types;
};

the type of the "types" typedef is a PackExpansionType whose pattern
is Types&.

This commit introduces support for creating pack expansions for
template type arguments, as above, but not for any other kind of pack
expansion, nor for any form of instantiation.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122223 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.variadic/p5.cpp
a669c534cf414339060868d70d2348fea9ce6c7d 16-Dec-2010 Douglas Gregor <dgregor@apple.com> Add tests checking for unexpanded parameter packs in declarations that
occur within statements. Teach Sema::ActOnExceptionDeclarator() to
check for unexpanded parameter packs in the exception type.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121984 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.variadic/p5.cpp
781def075d4a486a5b367c6730fe77cb1f721ac1 16-Dec-2010 Douglas Gregor <dgregor@apple.com> Check for unexpanded parameter packs in non-type template parameter types.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121964 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.variadic/p5.cpp
6f52675ec400a0ee89ec6214c4845b8ee274304a 16-Dec-2010 Douglas Gregor <dgregor@apple.com> Check for unexpanded parameter packs in default arguments.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121962 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.variadic/p5.cpp
a31040f16604849b3b1dc36015056c81bae68ad1 16-Dec-2010 Douglas Gregor <dgregor@apple.com> Check for unexpanded parameter packs within variable initializers.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121938 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.variadic/p5.cpp
6ccab97c17c17f38eb92c7fe02c766508875bd97 16-Dec-2010 Douglas Gregor <dgregor@apple.com> Check for unexpanded parameter packs in friend declarations.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121934 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.variadic/p5.cpp
56c04588ef3cfa1bbc968fd68de2480a4e66971d 16-Dec-2010 Douglas Gregor <dgregor@apple.com> Check for unexpanded parameter packs in using declarations. As a
drive-by, make sure to check for unexpanded parameter packs within the
name of a declaration.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121930 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.variadic/p5.cpp
0c9e4799fd78d350a037498b2c797f2b2558791c 16-Dec-2010 Douglas Gregor <dgregor@apple.com> Check for unexpanded parameter packs in enumeration types and enumerators.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121928 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.variadic/p5.cpp
399ad970a25efcbfa7111e17f48285a70fba2731 16-Dec-2010 Douglas Gregor <dgregor@apple.com> Check for unexpanded parameter packs in static assertion expressions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121922 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.variadic/p5.cpp
e186269a8a41dbff1ebea2c251048892979d1078 16-Dec-2010 Douglas Gregor <dgregor@apple.com> Check for unexpanded parameter packs in various kinds of
declarations. This is a work in progress, as I go through the C++
declaration grammar to identify where unexpanded parameter packs can
occur.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121912 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.variadic/p5.cpp
cff163e3cc78277496b30fa40070b46abdc290db 15-Dec-2010 Douglas Gregor <dgregor@apple.com> Test that all of the relevant types properly compute the "contains
unexpanded parameter pack" bit and that the recursive AST visitor can
then find those unexpanded parameter packs.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121899 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.variadic/p5.cpp
9ef75899bae6dd9a4be1252ae9cadcb619c170ff 15-Dec-2010 Douglas Gregor <dgregor@apple.com> Introduce a RecursiveASTVisitor subclass that finds all unexpanded
parameter packs within a statement, type, etc. Use this visitor to
provide improved diagnostics for the presence of unexpanded parameter
packs in a full expression, base type, declaration type, etc., by
highlighting the unexpanded parameter packs and providing their names,
e.g.,

test/CXX/temp/temp.decls/temp.variadic/p5.cpp:28:85: error: declaration type
contains unexpanded parameter packs 'VeryInnerTypes',
'OuterTypes', ...
...VeryInnerTypes, OuterTypes>, pair<InnerTypes, OuterTypes> > types;
~~~~~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ^



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121883 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.variadic/p5.cpp
bebbe0d9b7568ce43a464286bee49429489ef483 15-Dec-2010 Douglas Gregor <dgregor@apple.com> Variadic templates: extend the Expr class with a bit that specifies
whether the expression contains an unexpanded parameter pack, in the
same vein as the changes to the Type hierarchy. Compute this bit
within all of the Expr subclasses.

This change required a bunch of reshuffling of dependency
calculations, mainly to consolidate them inside the constructors and
to fuse multiple loops that iterate over arguments to determine type
dependence, value dependence, and (now) containment of unexpanded
parameter packs.

Again, testing is painfully sparse, because all of the diagnostics
will change and it is more important to test the to-be-written visitor
that collects unexpanded parameter packs.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121831 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.variadic/p5.cpp
d0937224f383c7cc72c947119380f9713a070c73 13-Dec-2010 Douglas Gregor <dgregor@apple.com> Variadic templates: extend Type, NestedNameSpecifier, TemplateName,
and TemplateArgument with an operation that determines whether there
are any unexpanded parameter packs within that construct. Use this
information to diagnose the appearance of the names of parameter packs
that have not been expanded (C++ [temp.variadic]p5). Since this
property is checked often (every declaration, ever expression
statement, etc.), we extend Type and Expr with a bit storing the
result of this computation, rather than walking the AST each time to
determine whether any unexpanded parameter packs occur.

This commit is deficient in several ways, which will be remedied with
future commits:
- Expr has a bit to store the presence of an unexpanded parameter
pack, but it is never set.
- The error messages don't point out where the unexpanded parameter
packs were named in the type/expression, but they should.
- We don't check for unexpanded parameter packs in all of the places
where we should.
- Testing is sparse, pending the resolution of the above three
issues.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121724 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.variadic/p5.cpp
8a72621a019a0b3ae793b1f5fc6da2243476979f 29-Nov-2010 John McCall <rjmccall@apple.com> Revert r120063, it was wrong.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120296 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/basic.namespace/namespace.udecl/p8.cpp
987cec3fe4aa0d1b8c2c48aeaa74160450e9235d 29-Nov-2010 Douglas Gregor <dgregor@apple.com> Add a test for C++ [stmt.label]p1, from Sashan!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120291 91177308-0d34-0410-b5e6-96231b3b80d8
tmt.stmt/stmt.label/p1.cpp
6abb078cc5d9999c3ba43cca89e199e6d54fa791 26-Nov-2010 Sebastian Redl <sebastian.redl@getdesigned.at> Forgot a file in r120182

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120184 91177308-0d34-0410-b5e6-96231b3b80d8
lass/class.nest/p1-cxx0x.cpp
f9780007a9c31a46a025bdd3eaf5c2be31eb4c0e 26-Nov-2010 Sebastian Redl <sebastian.redl@getdesigned.at> Allow access to non-static members without an object in sizeof expressions, in C++0x. Patch by Jakub Wieczorek.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120182 91177308-0d34-0410-b5e6-96231b3b80d8
lass/class.nest/p1.cpp
fe4ea55700c806493bebbf7bbfe07ce4b7339a3e 23-Nov-2010 John McCall <rjmccall@apple.com> Redeclarations of using declarations are not okay in function scopes.
Not sure what I was thinking before.

Fixes PR8668.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120063 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/basic.namespace/namespace.udecl/p8.cpp
f89e55ab1bfb3ea997f8b02997c611a02254eb2d 18-Nov-2010 John McCall <rjmccall@apple.com> Calculate the value kind of an expression when it's created and
store it on the expression node. Also store an "object kind",
which distinguishes ordinary "addressed" l-values (like
variable references and pointer dereferences) and bitfield,
@property, and vector-component l-values.

Currently we're not using these for much, but I aim to switch
pretty much everything calculating l-valueness over to them.
For now they shouldn't necessarily be trusted.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119685 91177308-0d34-0410-b5e6-96231b3b80d8
cl.decl/dcl.init/dcl.init.ref/p5-examples.cpp
8d706ecf488c4f548c4f8cf0aa08ea82a4d6a5ba 15-Nov-2010 Douglas Gregor <dgregor@apple.com> Implement C++0x [temp.func.order]p3 (aka DR532) properly. In
particular, we only add the implement object parameter type if only
one of the function templates is a non-static member function
template.

Moreover, since this DR differs from existing practice in C++98/03,
this commit implements the existing practice (which ignores the
first parameter of the function template that is not the non-static
member function template) in C++98/03 mode.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119145 91177308-0d34-0410-b5e6-96231b3b80d8
ver/over.match/over.match.funcs/p4.cpp
emp/temp.decls/temp.fct/temp.func.order/p3-0x.cpp
emp/temp.decls/temp.fct/temp.func.order/p3.cpp
77bc572138543ef97ebec137522b763d6a6ee909 13-Nov-2010 Douglas Gregor <dgregor@apple.com> Implement C++ [over.match.funcs]p4 as it concerns partial ordering of
function templates. Fixes PR8130.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118944 91177308-0d34-0410-b5e6-96231b3b80d8
ver/over.match/over.match.funcs/p4.cpp
8ff338bfd8abd9ac5d0c1d89c1b05e2c02727174 12-Nov-2010 Douglas Gregor <dgregor@apple.com> When performing initialization of a copy of a temporary object, use
direct-initialization (rather than copy-initialization) to initialize
the temporary, allowing explicit constructors. Fixes PR8342.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118880 91177308-0d34-0410-b5e6-96231b3b80d8
cl.decl/dcl.init/dcl.init.ref/p5-cxx03-extra-copy.cpp
d65587f7a6d38965fa37158d3f57990a7faf3836 10-Nov-2010 Douglas Gregor <dgregor@apple.com> Instantiate class member template partial specialization declarations
in the order they occur within the class template, delaying
out-of-line member template partial specializations until after the
class has been fully instantiated. This fixes a regression introduced
by r118454 (itself a fix for PR8001).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118704 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.class.spec/p6.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/expr.unary/expr.unary.op/p4.cpp
ver/over.over/p2.cpp
ver/over.over/p4.cpp
dfdfc584f2a8d9f1eebd6e6eaa9b1bbff519d8f9 07-Nov-2010 Anders Carlsson <andersca@mac.com> A union cannot contain static data members or data members of reference type.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118381 91177308-0d34-0410-b5e6-96231b3b80d8
lass/class.union/p1.cpp
053105d58552c600a2e56473592212a9bddafcd4 02-Nov-2010 Douglas Gregor <dgregor@apple.com> When performing template argument deduction against a template-id,
only keep deduction results for successful deductions, so that they
can be compared against each other. Fixes PR8462, from Richard Smith!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117983 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.fct.spec/temp.deduct/temp.deduct.call/p3.cpp
77a1a8868e03bb74412f001f32d66ce0c26afae6 23-Oct-2010 Douglas Gregor <dgregor@apple.com> C++ [basic.scope.hiding] allows an ordinary name to hide a non-tag
name *in the same scope*, but not across scopes. Implement the
highlighted condition.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117212 91177308-0d34-0410-b5e6-96231b3b80d8
asic/basic.scope/basic.scope.hiding/p2.cpp
f17b58c98b57537e9abfaaa8b5f19ea7e6de01ee 23-Oct-2010 Douglas Gregor <dgregor@apple.com> In the presence of using declarations, we can find the same class
members in class subobjects of different types. So long as the
underlying declaration sets are the same, and the declaration sets
involve non-instance members, this is not an ambiguity.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117163 91177308-0d34-0410-b5e6-96231b3b80d8
lass.derived/class.member.lookup/p9.cpp
fe7574b3adc7b38e70dc4ecd335e8c9b38ab549f 22-Oct-2010 Douglas Gregor <dgregor@apple.com> When performing name lookup for a namespace definition, only look into
the current context's redeclaration context, ignoring using
directives. Fixes PR8430.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117097 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/basic.namespace/namespace.def/p2.cpp
369ea27b56b89379023366ff1b8ab362b5709e4e 21-Oct-2010 Douglas Gregor <dgregor@apple.com> Diagnose the declaration of template template parameters that
themselves have no template parameters. This is actually a restriction
due to the grammar of template template parameters, but we choose to
diagnose it in Sema to provide better recovery.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117032 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.param/p1.cpp
0bab54cf82cd679152197c7a2eb938f8aa9f07dd 21-Oct-2010 Douglas Gregor <dgregor@apple.com> Always treat 'main' as an extern "C" function, so that we detect
redeclarations of main appropriately rather than allowing it to be
overloaded. Also, disallowing declaring main as a template.

Fixes GCC DejaGNU g++.old-deja/g++.other/main1.C.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117029 91177308-0d34-0410-b5e6-96231b3b80d8
asic/basic.start/basic.start.main/p2h.cpp
aa56a66abb61e9f42b48ae88e43328aba10c9148 20-Oct-2010 John McCall <rjmccall@apple.com> Access control polish: drop the note on the original declaration and
say 'implicitly' when it was implicit. Resolves PR 7930 and my peace of mind.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116916 91177308-0d34-0410-b5e6-96231b3b80d8
lass.access/class.friend/p1.cpp
lass.access/p4.cpp
4e2cbb28baa0342b51336e55c519cd06308c4df2 20-Oct-2010 John McCall <rjmccall@apple.com> When matching template parameter lists to template-ids in a scope specifier
on a friend declaration, skip template-ids which do not depend on the
current parameter list.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116911 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.friend/p1.cpp
c54d688c604d28dcb9ab8f92047837c10c8f9c61 19-Oct-2010 John McCall <rjmccall@apple.com> When instantiating a dependently-scoped friend function declaration,
we may need to complete the type before looking into it.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116795 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.friend/p1.cpp
4eab39f0745fb1949dbb40c4145771b927888242 19-Oct-2010 John McCall <rjmccall@apple.com> Instantiate enclosing template parameter lists when instantiating friends.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116789 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.friend/p5.cpp
613ef3d4c144f8c35224daf28a187426d2044aee 19-Oct-2010 John McCall <rjmccall@apple.com> Uncomputable contexts are always records but can exist.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116787 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.friend/p5.cpp
9a34edb710917798aa30263374f624f13b594605 19-Oct-2010 John McCall <rjmccall@apple.com> Redirect templated friend class decls to a new Sema callback and
construct an unsupported friend when there's a friend with a templated
scope specifier. Fixes a consistency crash, rdar://problem/8540527


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116786 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.friend/p5.cpp
693d467ed44ecb754762aff129accce30c306422 18-Oct-2010 Anders Carlsson <andersca@mac.com> Implement the first half of [dcl.attr.override]p6.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116709 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/dcl.attr/dcl.attr.override/p6.cpp
4d09e84fbb0305372efc778a6770f0c3a5b5b2ae 18-Oct-2010 Anders Carlsson <andersca@mac.com> Implement [dcl.attr.override]p2 and add tests for p1 and p2.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116692 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/dcl.attr/dcl.attr.override/p1.cpp
7759919062b4e773791f1b49dabf0a509c4a7406 18-Oct-2010 Anders Carlsson <andersca@mac.com> Add test for [dcl.attr.final]p4.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116691 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/dcl.attr/dcl.attr.final/p4.cpp
a6e937ce32474934778346f4d51c3beec40e77ec 15-Oct-2010 Douglas Gregor <dgregor@apple.com> Diagnose C++ [class.mem]p13-14, where a class member has the same name
as the class itself. Fixes PR7082.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116573 91177308-0d34-0410-b5e6-96231b3b80d8
lass/class.mem/p13.cpp
lass/class.mem/p14.cpp
5a1f97ee183d2614db58452a4380dd11cb309263 15-Oct-2010 Douglas Gregor <dgregor@apple.com> Add builtin conditional operator candidates for scoped enumeration
types, from Alp Toker! Fixes PR8344.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116549 91177308-0d34-0410-b5e6-96231b3b80d8
ver/over.built/p25.cpp
8a407370c37229f2b69fe643850959b98899c28a 15-Oct-2010 John McCall <rjmccall@apple.com> template-ids are looked up differently in friend declarations.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116529 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/basic.namespace/namespace.def/namespace.memdef/p3.cpp
708f3b8e350a5c0605889a4f32b26686864495ca 15-Oct-2010 Douglas Gregor <dgregor@apple.com> Make sure that we diagnose invalid qualifiers on friend functions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116527 91177308-0d34-0410-b5e6-96231b3b80d8
lass/class.friend/p1.cpp
cl.decl/dcl.meaning/dcl.fct/p6.cpp
29ae6e5fb001deddd831e66faf143ecd9e50f67c 13-Oct-2010 John McCall <rjmccall@apple.com> Support friend function declarations in local classes correctly.
Fixes a crash and diagnoses the error condition of an unqualified
friend which doesn't resolve to something. I'm still not certain how
this is useful.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116393 91177308-0d34-0410-b5e6-96231b3b80d8
lass.access/class.friend/p11.cpp
5f3aeb6f8b1e1cc00015407ef6886429f9b7fb78 13-Oct-2010 Douglas Gregor <dgregor@apple.com> Teach the warning about unnamed/local types in template arguments to
actually walk the template argument type to find any unnamed/local
types within it. Fixes PR6784.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116382 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.arg/temp.arg.type/p2.cpp
9b623639378d53a675921ddfa7316034d571881e 13-Oct-2010 Douglas Gregor <dgregor@apple.com> Introduce support for emitting diagnostics (warnings + their notes)
that are suppressed during template argument deduction. This change
queues diagnostics computed during template argument deduction. Then,
if the resulting function template specialization or partial
specialization is chosen by overload resolution or partial ordering
(respectively), we will emit the queued diagnostics at that point.

This addresses most of PR6784. However, the check for unnamed/local
template arguments (which existed before this change) is still only
skin-deep, and needs to be extended to look deeper into types. It must
be improved to finish PR6784.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116373 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.arg/temp.arg.type/p2.cpp
337ec3d0e8cb24a591ecbecdc0a995a167f6af01 13-Oct-2010 John McCall <rjmccall@apple.com> Handle dependent friends more explicitly and deal with the possibility
of templated-scope friends by marking them invalid and white-listing all
accesses until such time as we implement them. Fixes a crash, this time
without a broken test case.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116364 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.friend/p5.cpp
98efb9f6df133f5508d260c4510c6c3bd70f34ad 12-Oct-2010 Eli Friedman <eli.friedman@gmail.com> PR8325: don't do destructor checking when a pointer is thrown.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116336 91177308-0d34-0410-b5e6-96231b3b80d8
lass.access/p4.cpp
3273b0cea879c7af345d6bf98502bbf73fc4fde1 12-Oct-2010 Douglas Gregor <dgregor@apple.com> When finalizing a function template specialization following template
argument deduction, make sure to check the correctness of deduced template
type arguments (which we had previously skipped) along with other
kinds of template arguments. This fixes part of PR6784, but we're
still swallowing the extension warning about unnamed/local template
arguments.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116327 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.arg/temp.arg.type/p2.cpp
8cfb7a39caa44797522773cf417ad9c1a6ffbc6f 12-Oct-2010 Douglas Gregor <dgregor@apple.com> If we end up instantiating a function parameter whose default argument
has not yet been parsed, note that the default argument hasn't been
parsed and keep track of all of the instantiations of that function
parameter. When its default argument does get parsed, imbue the
instantiations with that default argument. Fixes PR8245.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116324 91177308-0d34-0410-b5e6-96231b3b80d8
lass/class.mem/p1.cpp
d54eb4410330383f48d3cc22b2ad8d23f120836b 12-Oct-2010 Douglas Gregor <dgregor@apple.com> Parse default arguments within member functions in source order, from
Manuel Klimek! Fixes PR7715.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116311 91177308-0d34-0410-b5e6-96231b3b80d8
lass/class.mem/p1b.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/expr.unary/expr.unary.op/p6.cpp
emp/temp.fct.spec/temp.arg.explicit/p3-nodeduct.cpp
b72db8977ed032d6425045d7e9d36e49d9b2d3f8 05-Oct-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> In Sema's TryRefInitWithConversionFunction, suppress user conversions for the overload candidates.
Fixes an infinite recursion in overload resolution for rdar://8499524.
Many thanks to Doug!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@115588 91177308-0d34-0410-b5e6-96231b3b80d8
cl.decl/dcl.init/dcl.init.ref/p5-var.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/expr.unary/expr.unary.op/p6.cpp
069ea646616e4ece684e1dec652640f644f0d40a 17-Sep-2010 Douglas Gregor <dgregor@apple.com> When dealing with an anonymous enumeration declared in function
prototype scope, temporarily set the context of the enumeration
declaration to the translation unit. We do the same thing for
parameters, until we have an actual function declaration on which to
hang them. Fixes <rdar://problem/8435682>.

There is more work to do in this area, since we have existing bugs
with tags being declared/defined in function parameter lists. This fix
is correct, and we'll end up extending it when we deal with those
existing bugs.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114135 91177308-0d34-0410-b5e6-96231b3b80d8
cl.decl/dcl.meaning/dcl.fct/p8.cpp
2c5399f99c95b831fa90fd3a3c1d9719c1dd9441 13-Sep-2010 Abramo Bagnara <abramo.bagnara@gmail.com> Parentheses around address non-type template argument is demoted to an extension warning.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113739 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.arg/temp.arg.nontype/p5.cpp
c6dbc3fa467e2355b678a6b717534928048efcb2 12-Sep-2010 Douglas Gregor <dgregor@apple.com> Diagnose the instantiation of variables (including static data
members) with function type. Fixes PR8047.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113723 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.arg/temp.arg.type/p2.cpp
a4d5de539bc2f0cd25d6292e84eaa067591ff792 12-Sep-2010 Douglas Gregor <dgregor@apple.com> When diagnosing C++ [temp.expl.spec]p3 in C++98/03 mode, downgrade the
error to a warning if we're in a case that would be allowed in
C++0x. This "fixes" PR8084 by making Clang accept more code than GCC
and (non-strict) EDG do.

Also, add the missing test case for the C++0x semantics, which should
have been in r113717.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113718 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.spec/temp.expl.spec/p2-0x.cpp
emp/temp.spec/temp.expl.spec/p2.cpp
661b4939ae3f84380dc3e670a06e963b4b9d3b6e 12-Sep-2010 Douglas Gregor <dgregor@apple.com> Implement the "note" in C++ [over.built]p1, which is actually meant to
be a semantic requirement that a built-in overloaded operator is not
added to the overload set of there is already a user-defined
overloaded operator with the same parameter types. Fixes PR8087.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113713 91177308-0d34-0410-b5e6-96231b3b80d8
ver/over.built/p1.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/expr.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/expr.unary/expr.unary.noexcept/cg.cpp
xpr/expr.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/expr.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/expr.unary/expr.unary.noexcept/cg.cpp
xpr/expr.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/expr.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/expr.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/expr.unary/expr.unary.noexcept/sema.cpp
32212f9d000e6bb631499afce43cd13fc0387413 06-Sep-2010 Chris Lattner <sabre@nondot.org> remove curly quotes, patch by Dimitry Andric!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113156 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.spec/temp.explicit/p12.cpp
2f69a816a0986caa24d8e4273a3f83420b05f707 05-Sep-2010 Chris Lattner <sabre@nondot.org> "const std::vector<int>*" not "std::vector<int> const*"


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113094 91177308-0d34-0410-b5e6-96231b3b80d8
asic/basic.lookup/basic.lookup.argdep/p4.cpp
0c42bb653dc40b1caae010618831e320af824b18 05-Sep-2010 Chris Lattner <sabre@nondot.org> 'const std::type_info*' instead of 'std::type_info const*'



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113092 91177308-0d34-0410-b5e6-96231b3b80d8
cl.decl/dcl.init/dcl.init.ref/p5-examples.cpp
cl.decl/dcl.init/dcl.init.ref/p5-var.cpp
cl.decl/dcl.init/p6.cpp
pecial/class.copy/p9.cpp
58f9e13e87e57236fee4b914eea9be6f92a1c345 05-Sep-2010 Chris Lattner <sabre@nondot.org> make clang print types as "const int *" instead of "int const*",
which is should have done from the beginning. As usual, the most
fun with this sort of change is updating all the testcases.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113090 91177308-0d34-0410-b5e6-96231b3b80d8
cl.decl/dcl.init/dcl.init.ref/p5-examples.cpp
cl.decl/dcl.init/dcl.init.ref/p5-var.cpp
cl.decl/dcl.init/p6.cpp
cl.decl/dcl.meaning/dcl.array/p1.cpp
emp/temp.arg/temp.arg.nontype/p5.cpp
emp/temp.decls/temp.mem/p5.cpp
17fb855280be411389361f1c79753e0013c4187c 03-Sep-2010 Chandler Carruth <chandlerc@gmail.com> Allow anonymous and local types. The support was already in place for these,
but this makes them work even as an extension in C++98. This resolves PR8077.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113011 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.arg/temp.arg.type/p2-cxx0x.cpp
fe24e05a87e48fa3318b65d1a92c542107639fd9 03-Sep-2010 John McCall <rjmccall@apple.com> Add a quick-and-dirty hack to give a better diagnostic for [class.protected]
restrictions. The note's not really on the right place given its wording,
but putting a second note on the call site (or muddying the wording) doesn't
appeal.

There are corner cases where this can be wrong, but I'm not concerned.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112950 91177308-0d34-0410-b5e6-96231b3b80d8
lass.access/class.protected/p1.cpp
lass.access/p4.cpp
410c4f2eb5e6a8c2318cacb9a6751f1b4fcff166 31-Aug-2010 Sebastian Redl <sebastian.redl@getdesigned.at> Make inline namespace not be transparent after all. The concept simply doesn't fit. Instead, special-case the few places where transparent contexts have the desired behavior for inline namespaces. Fixes a redeclaration issue in inline namespaces.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112637 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/basic.namespace/namespace.def/p8.cpp
1baf2f778c26a71d1353ff2cc1701fcd1dbeaf76 31-Aug-2010 Chandler Carruth <chandlerc@gmail.com> Fix a regression that allowed clearly ill formed code. The diagnostic is still
terrible, FIXME left to do a proper job of diagnosing this.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112581 91177308-0d34-0410-b5e6-96231b3b80d8
cl.decl/dcl.init/p5.cpp
88e64ca96d6c00c6f3bd43772cd325bede795d2a 31-Aug-2010 Sebastian Redl <sebastian.redl@getdesigned.at> Enable inline namespaces in C++03 as an extension.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112566 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/basic.namespace/namespace.def/p1.cpp
03b16a7d476789d62d61d3e57e75f0bf6a8229bb 31-Aug-2010 Sebastian Redl <sebastian.redl@getdesigned.at> Add a forgotten place where the enclosing namespace set matters, plus a big testcase for inline namespace fun.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112565 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/basic.namespace/namespace.def/p8.cpp
4e4d57069cf9402728e05f7fc856295a86e4801f 31-Aug-2010 Sebastian Redl <sebastian.redl@getdesigned.at> Enable inline namespaces in the AST.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112564 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/basic.namespace/namespace.def/p7.cpp
7e010a04fef171049291d8cb3047f118566da090 31-Aug-2010 Douglas Gregor <dgregor@apple.com> When instantiating a function type, instantiate the return type before
instantiating the parameters. In a perfect world, this wouldn't
matter, and compilers are free to instantiate in any order they
want. However, every other compiler seems to instantiate the return
type first, and some code (in this case, Boost.Polygon) depends on
this and SFINAE to avoid instantiating something that shouldn't be
instantiated.

We could fight this battle, and insist that Clang is allowed to do
what it does, but it's not beneficial: it's more predictable to
instantiate this way, in source order. When we implement
late-specified return types, we'll need to instantiate the return type
last when it was late-specified, hence the FIXME.

We now compile Boost.Polygon properly.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112561 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.fct.spec/temp.deduct/sfinae-1.cpp
75f21af57f3dce1577d6c27bbe7bb45b49ced732 30-Aug-2010 Douglas Gregor <dgregor@apple.com> Perform the function-to-pointer adjustment during template argument
deduction where the parameter is a function reference, function
pointer, or member function pointer and the argument is an overloaded
function. Fixes <rdar://problem/8360106>, a template argument
deduction issue found by Boost.Filesystem.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112523 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.fct.spec/temp.deduct/temp.deduct.call/p6.cpp
df48ddf97fb5a1310c99f3ece5255477dc1bbbdb 30-Aug-2010 Douglas Gregor <dgregor@apple.com> Add test case from PR6952, which now works (thanks to Gabor).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112477 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.friend/p4.cpp
7f6ff02d66bcf397cbe154da89de97fd5f96657c 30-Aug-2010 Douglas Gregor <dgregor@apple.com> Add redeclaration checking for static data members and fix a corner
case with redeclaration checking for fields, from Faisal Vali!
Fixes PR7970.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112476 91177308-0d34-0410-b5e6-96231b3b80d8
lass/class.mem/p1.cpp
326c8c7d6e6996c82a1da55c1c3cd6cb4b89a584 28-Aug-2010 John McCall <rjmccall@apple.com> That's not the right direction to compute notional accessibility in at all.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112360 91177308-0d34-0410-b5e6-96231b3b80d8
lass.access/class.protected/p1.cpp
8c77bcb072e7fd089f39fd7e079b6d767bf583fa 28-Aug-2010 John McCall <rjmccall@apple.com> When checking access control for an instance member access on
an object of type I, if the current access target is protected
when named in a class N, consider the friends of the classes P
where I <= P <= N and where a notional member of N would be
non-forbidden in P.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112358 91177308-0d34-0410-b5e6-96231b3b80d8
lass.access/class.protected/p1.cpp
d078e641450bbc5a20df8d3b54f87b27e398acb3 28-Aug-2010 Sebastian Redl <sebastian.redl@getdesigned.at> Parser support for inline namespaces

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112320 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/basic.namespace/namespace.def/p1.cpp
58e390ef491c8fb11ae17445054ee09527b492d3 25-Aug-2010 Chandler Carruth <chandlerc@gmail.com> Support explicit instantiation of function templates and members of class
templates when only the declaration is in scope. This requires deferring the
instantiation to be lazy, and ensuring the definition is required for that
translation unit. We re-use the existing pending instantiation queue,
previously only used to track implicit instantiations which were required to be
lazy. Fixes PR7979.

A subsequent change will rename *PendingImplicitInstantiations to
*PendingInstatiations for clarity given its broader role.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112037 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.spec/temp.explicit/p3.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
lass/class.mfct/class.mfct.non-static/p3.cpp
xpr/expr.unary/expr.unary.op/p4.cpp
fb97e75e627599aaa7a613778134e290f9de663b 25-Aug-2010 John McCall <rjmccall@apple.com> When trying to resolve the address of an overloaded expression,
only form pointers-to-member if the expression has the appropriate
form. This avoids assertions later on on invalid code, but also
allows us to properly resolve mixed-staticity overloads.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111987 91177308-0d34-0410-b5e6-96231b3b80d8
lass/class.mfct/class.mfct.non-static/p3.cpp
3a91abf311dcc399944882004f3e0b29489d31c7 24-Aug-2010 Douglas Gregor <dgregor@apple.com> Diagnose the presence of multiple initializations of static data
members, from Faisal Vali! Fixes PR6904.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111900 91177308-0d34-0410-b5e6-96231b3b80d8
lass/class.static/class.static.data/p4.cpp
72c4c15e030cabf71cffc899ca779a251bcc72d1 20-Aug-2010 Douglas Gregor <dgregor@apple.com> Revert r111609, which is failing its new test.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111611 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.friend/p5.cpp
29c695b86199ce917fd59b875683960a1858342a 20-Aug-2010 John McCall <rjmccall@apple.com> Detect efforts to declare a template member friend and explicitly ignore them.
Avoids a crash.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111609 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.friend/p5.cpp
8ba6691248004e1a726ba5f29d717950f8054507 13-Aug-2010 John McCall <rjmccall@apple.com> Work around a crash when checking access to injected class names
qua templates. The current fix suppresses the access check entirely
in this case; to do better, we'd need to be able to say that a
particular lookup result came from a particular injected class name,
which is not easy to do with the current representation of LookupResult.
This is on my known-problems list.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111009 91177308-0d34-0410-b5e6-96231b3b80d8
lass.access/p4.cpp
b8592063413d277f6583715c9a890bd58440c1d1 13-Aug-2010 John McCall <rjmccall@apple.com> Perform access control when template lookup finds a class template.
This is *really* hacky.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110997 91177308-0d34-0410-b5e6-96231b3b80d8
lass.access/p4.cpp
7f1c547ee6cd413845f7df9713c701f99866f91d 11-Aug-2010 Douglas Gregor <dgregor@apple.com> If name lookup finds different type declarations in different scopes
that actually refer to the same underlying type, it is not an
ambiguity; add uniquing support based on the canonical type of type
declarations. Fixes <rdar://problem/8296180>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110806 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/basic.namespace/namespace.udecl/p10.cpp
cl.dcl/basic.namespace/namespace.udir/p6.cpp
604eb65686590f73551d4ea608b174d2244cdd0f 11-Aug-2010 Douglas Gregor <dgregor@apple.com> Improve our handling of user-defined conversions when computing
implicit conversion sequences. In particular, model the "standard
conversion" from a class to its own type (or a base type) directly as
a standard conversion in the normal path *without* trying to determine
if there is a valid copy constructor. This appears to match the intent
of C++ [over.best.ics]p6 and more closely matches GCC and EDG.

As part of this, model non-lvalue reference initialization via
user-defined conversion in overloading the same way we handle it in
InitializationSequence, separating the "general user-defined
conversion" and "conversion to compatible class type" cases.

The churn in the overload-call-copycon.cpp test case is because the
test case was originally wrong; it assumed that we should do more
checking for copy constructors that we actually should, which affected
overload resolution.

Fixes PR7055. Bootstrapped okay.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110773 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/dcl.spec/dcl.stc/p9.cpp
ed328c6129152f66771c3bed338a2e6e13e4e230 06-Aug-2010 Douglas Gregor <dgregor@apple.com> Diagnose the use of "inline" on block-scope function declarations in
C++, from Andrea Nall!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110439 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/dcl.spec/dcl.fct.spec/p3.cpp
1357869bc5983cdfbc986db1f3d18265bb34cb0e 05-Aug-2010 Eli Friedman <eli.friedman@gmail.com> Get rid of isObjectType; when C++ says "object type", it generally
just means "not a function type", not "not a function type or void". This
changes behavior slightly, but generally in a way which accepts more code.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110303 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.param/p4.cpp
7f584bbe9c2de8455bfb572d4ab571628c6c024e 05-Aug-2010 Sebastian Redl <sebastian.redl@getdesigned.at> Drop an unjustified limitation from Type::isObjectType(). Fixes PR7801 and doesn't seem to break anything.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110295 91177308-0d34-0410-b5e6-96231b3b80d8
onv/conv.ptr/p2.cpp
d05b1b2a4426037d53931c95c9ca685aa03d21f8 04-Aug-2010 John McCall <rjmccall@apple.com> Add a test case for P%7346, which was fixed by not doing the operator
delete lookup until the end of the class definition.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110176 91177308-0d34-0410-b5e6-96231b3b80d8
pecial/class.dtor/p9.cpp
15442825bb2c3f2cc48f3ed753d172beb8ed1232 04-Aug-2010 John McCall <rjmccall@apple.com> Only look up an 'operator delete' on the definition of a destructor, not on
a declaration.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110175 91177308-0d34-0410-b5e6-96231b3b80d8
pecial/class.dtor/p9.cpp
046a7466f23107bd752d9a8106aada85061699bc 04-Aug-2010 John McCall <rjmccall@apple.com> Look through using declarations when deciding whether to use an operator
delete for a virtual destructor. Diagnose ambiguities.

Fixes PR7803.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110173 91177308-0d34-0410-b5e6-96231b3b80d8
pecial/class.dtor/p9.cpp
c9068d7dd94d439cec66c421115d15303e481025 16-Jul-2010 John McCall <rjmccall@apple.com> Treat template parameters as part of the declaration-specifiers for the
purpose of access control. Fixes PR7644.

I can't actually find anything directly justifying this, but it seems obvious.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108521 91177308-0d34-0410-b5e6-96231b3b80d8
lass.access/p6.cpp
66a8c9a6b1f9bcd78779e5d414f3c9ae3cabdd93 15-Jul-2010 Douglas Gregor <dgregor@apple.com> When determining whether an overload set with explicit template
arguments only resolves to a single specialization, make sure to look
through using declarations. Fixes PR7641.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108376 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.fct.spec/temp.arg.explicit/p3.cpp
44eac33ae12df384f3f002102f919f603bee330f 13-Jul-2010 Douglas Gregor <dgregor@apple.com> Reinstate the optimization suppressing available_externally functions
at -O0. The only change from the previous patch is that we don't try
to generate virtual method thunks for an available_externally
function.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108230 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.spec/temp.explicit/p9-linkage.cpp
27cc6331e33efac4020058d2fda36c9060ec5afa 12-Jul-2010 Douglas Gregor <dgregor@apple.com> Speculatively revert r108156; it appears to be breaking self-host.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108194 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.spec/temp.explicit/p9-linkage.cpp
7ce1f2714ac0f33210bab14650bce2078ebf343e 12-Jul-2010 Douglas Gregor <dgregor@apple.com> Do not generate LLVM IR for available_externally function bodies at
-O0, since we won't be using the definitions for anything anyway. For
lib/System/Path.o when built in Debug+Asserts mode, this leads to a 4%
improvement in compile time (and suppresses 440 function bodies).

<rdar://problem/7987644>



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108156 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.spec/temp.explicit/p9-linkage.cpp
39dbad9b67cd9e36b9cd3b48a16caf7e4461211e 08-Jul-2010 John McCall <rjmccall@apple.com> Apparently the {{$}} hack doesn't work on Windows; I am saddened but not
surprised.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107874 91177308-0d34-0410-b5e6-96231b3b80d8
xcept/except.spec/p14-ir.cpp
9c0c1f333ab8f5a3da055b99ee94778689face17 08-Jul-2010 John McCall <rjmccall@apple.com> Mark calls to 'throw()' functions as nounwind, and mark the functions nounwind
as well.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107858 91177308-0d34-0410-b5e6-96231b3b80d8
xcept/except.spec/p14-ir.cpp
ed8abf18329df67b0abcbb3a10458bd8c1d2a595 08-Jul-2010 Douglas Gregor <dgregor@apple.com> Reinstate the fix for PR7556. A silly use of isTrivial() was
suppressing copies of objects with trivial copy constructors.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107857 91177308-0d34-0410-b5e6-96231b3b80d8
lass.access/p4.cpp
84745677f64863e025a6733cb29d0b94bc3a6ae2 08-Jul-2010 Douglas Gregor <dgregor@apple.com> Revert r107828 and r107827, the fix for PR7556, which seems to be
breaking bootstrap on Linux.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107837 91177308-0d34-0410-b5e6-96231b3b80d8
lass.access/p4.cpp
c0fee50ce432a63b7c4ee73e73a464af1bf388a0 08-Jul-2010 Sebastian Redl <sebastian.redl@getdesigned.at> Rip out the C++0x-specific handling of destructor names. The specification is still in flux and unclear, and our interim workaround was broken. Fixes PR7467.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107835 91177308-0d34-0410-b5e6-96231b3b80d8
asic/basic.lookup/basic.lookup.qual/p6-0x.cpp
09acc9863fe422dc83725f77991bf80551664ada 08-Jul-2010 Douglas Gregor <dgregor@apple.com> A using declaration can redeclare a typedef to the same type. These
typedefs won't have the same canonical declaration (since they are
distinct), so we need to check for this case specifically. Fixes
<rdar://problem/8018262>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107833 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/basic.namespace/namespace.udecl/p13.cpp
63ef464c3fad1e8b9f9360baa6c81f974b712e90 08-Jul-2010 Douglas Gregor <dgregor@apple.com> Do not use CXXZeroValueInitExpr for class types. Instead, use
CXXConstructExpr/CXXTemporaryObjectExpr/CXXNewExpr as
appropriate. Fixes PR7556, and provides a slide codegen improvement
when copy-initializing a POD class type from a value-initialized
temporary. Previously, we weren't eliding the copy.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107827 91177308-0d34-0410-b5e6-96231b3b80d8
lass.access/p4.cpp
f1549f66a8216a78112286e3978cea2c29d6334c 06-Jul-2010 John McCall <rjmccall@apple.com> Validated by nightly-test runs on x86 and x86-64 darwin, including after
self-host. Hopefully these results hold up on different platforms.

I tried to keep the GNU ObjC runtime happy, but it's hard for me to test.
Reimplement how clang generates IR for exceptions. Instead of creating new
invoke destinations which sequentially chain to the previous destination,
push a more semantic representation of *why* we need the cleanup/catch/filter
behavior, then collect that information into a single landing pad upon request.

Also reorganizes how normal cleanups (i.e. cleanups triggered by non-exceptional
control flow) are generated, since it's actually fairly closely tied in with
the former. Remove the need to track which cleanup scope a block is associated
with.

Document a lot of previously poorly-understood (by me, at least) behavior.

The new framework implements the Horrible Hack (tm), which requires every
landing pad to have a catch-all so that inlining will work. Clang no longer
requires the Horrible Hack just to make exceptions flow correctly within
a function, however. The HH is an unfortunate requirement of LLVM's EH IR.




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107631 91177308-0d34-0410-b5e6-96231b3b80d8
xcept/except.spec/p14-ir.cpp
eb8c670d2949eb62005eca36c64c9461f2a2173e 02-Jul-2010 Douglas Gregor <dgregor@apple.com> Provide exception specifications for implicitly-declared default constructors.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107437 91177308-0d34-0410-b5e6-96231b3b80d8
xcept/except.spec/p14-ir.cpp
0d405db2d847acba979a74d747894bcf4d580fe3 01-Jul-2010 Douglas Gregor <dgregor@apple.com> Provide exception specifications for implicitly-declared copy constructors.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107429 91177308-0d34-0410-b5e6-96231b3b80d8
xcept/except.spec/p14-ir.cpp
1619342d7ffcfdfd3e18b7c6da38d2bcbe2bb3f5 01-Jul-2010 Douglas Gregor <dgregor@apple.com> Test implicit declaration of copy assignment operator with non-const argument

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107421 91177308-0d34-0410-b5e6-96231b3b80d8
pecial/class.copy/p20.cpp
598a8543ec4c22e7f0a27e7ff2cf7e49cfa4e4ff 01-Jul-2010 Douglas Gregor <dgregor@apple.com> Teach DeclareImplicitCopyConstructor how to cope with virtual bases
and multi-dimensional array fields. Fixes several bugs found by
inspection.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107411 91177308-0d34-0410-b5e6-96231b3b80d8
pecial/class.copy/p9.cpp
b87786f045d798b070980c108c922e1475d27b15 01-Jul-2010 Douglas Gregor <dgregor@apple.com> Provide an exception-specification for an implicitly-declared
copy-assignment operator.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107406 91177308-0d34-0410-b5e6-96231b3b80d8
xcept/except.spec/p14.cpp
c05babe58ca0fe825a2c4d362f132f409217e39a 01-Jul-2010 Douglas Gregor <dgregor@apple.com> Add Sema test case for exception-specifiers implicitly added to destructors.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107395 91177308-0d34-0410-b5e6-96231b3b80d8
xcept/except.spec/p14.cpp
d7115a81b1a70db1652a7b518dbdaefa3bb6b3fd 01-Jul-2010 Douglas Gregor <dgregor@apple.com> Add test case that I forgot to commit with r107354 (the implementation
of C++ DR481).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107359 91177308-0d34-0410-b5e6-96231b3b80d8
asic/basic.scope/basic.scope.pdecl/p9.cpp
9fde9c424f734e1ef45177999e3a04faad127414 29-Jun-2010 Daniel Dunbar <daniel@zuster.org> tests: Use %clangxx when using driver for C++, in case C++ support is disabled.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107153 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/basic.namespace/namespace.udecl/p10.cpp
926c4b486a08f698cd3a367fd6f1a3a07604358d 28-Jun-2010 Chandler Carruth <chandlerc@gmail.com> Partial fix for PR7267 based on comments by John McCall on an earlier patch.
This is more targeted, as it simply provides toggle actions for the parser to
turn access checking on and off. We then use these to suppress access checking
only while we parse the template-id (included scope specifier) of an explicit
instantiation and explicit specialization of a class template. The
specialization behavior is an extension, as it seems likely a defect that the
standard did not exempt them as it does explicit instantiations.

This allows the very common practice of specializing trait classes to work for
private, internal types. This doesn't address instantiating or specializing
function templates, although those apparently already partially work.

The naming and style for the Action layer isn't my favorite, comments and
suggestions would be appreciated there.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106993 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.spec/temp.explicit/p11.cpp
0b495cdb1939f8b9e8a470e138dba5204872c38c 25-Jun-2010 Benjamin Kramer <benny.kra@googlemail.com> A bug I've introduced in STDIN handling surfaced a few broken tests, fix them.

Lexer/hexfloat.cpp is now XFAIL'd, I'd appreciate if someone could look into it.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106840 91177308-0d34-0410-b5e6-96231b3b80d8
lass.access/class.access.dcl/p1.cpp
a2dd828ce66a67bc21c3a553e2d99ca4f182d923 16-Jun-2010 Douglas Gregor <dgregor@apple.com> Downgrade the error when using a typedef in the nested-name-specifier
of an explicit instantiation to an ExtWarn, since nobody else seems to
diagnose this problem.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106109 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.spec/temp.explicit/p2.cpp
ad00b7705f9bbee81beeac428e7c6587734ab5a6 16-Jun-2010 John McCall <rjmccall@apple.com> Fix a point of semantics with using declaration hiding: method templates
introduced by using decls are hidden even if their template parameter lists
or return types differ from the "overriding" declaration.

Propagate using shadow declarations around more effectively when looking up
template-ids. Reperform lookup for template-ids in member expressions so that
access control is properly set up.

Fix some number of latent bugs involving template-ids with totally invalid
base types. You can only actually get these with a scope specifier, since
otherwise the template-id won't parse as a template-id.

Fixes PR7384.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106093 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/basic.namespace/namespace.udecl/p12.cpp
737801257f795632175517ffce4a80c62fc7bff7 09-Jun-2010 Sebastian Redl <sebastian.redl@getdesigned.at> Commit my WIP on constexpr support. This commit: an XFAILed test and treating constexpr as a top-level const.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105752 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/dcl.spec/dcl.constexpr/p1.cpp
57d12fd4a2bc739c4a4d62a364b7f08cd483c59e 07-Jun-2010 Jeffrey Yasskin <jyasskin@google.com> PR7245: Make binding a reference to a temporary without a usable copy
constructor into an extension warning into the error that C++98 requires.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105529 91177308-0d34-0410-b5e6-96231b3b80d8
cl.decl/dcl.init/dcl.init.ref/p5-cxx03-extra-copy.cpp
cl.decl/dcl.init/dcl.init.ref/p5-cxx0x-no-extra-copy.cpp
21d07e499e108752c9d63d7418f7d9b485f4e0e6 05-Jun-2010 Jeffrey Yasskin <jyasskin@google.com> Add an extension to avoid an error when a global template has the same name as
a member template, and you try to call the member template with an explicit
template argument. See PR7247

For example, this downgrades the error to a warning in:

template<typename T> struct set{};
struct Value {
template<typename T>
void set(T value) {
}
};
void foo() {
Value v;
v.set<double>(3.2); // Warning here.
}



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105518 91177308-0d34-0410-b5e6-96231b3b80d8
asic/basic.lookup/basic.lookup.classref/p1.cpp
a417b87e5d0f0508c7b18824d89d489bb55b7bd1 04-Jun-2010 Douglas Gregor <dgregor@apple.com> When checking for equality of template parameter lists, a template
type parameter pack is distinct from a template type parameter.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105464 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.variadic/parameter-matching.cpp
7b6d25b04cb86bbe6940d87dc73da8fbbebda5bd 04-Jun-2010 Douglas Gregor <dgregor@apple.com> Properly disambiguate between an elaborated-type-specifier and a
type-parameter within a template parameter list. Found by inspection.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105462 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.param/p2.cpp
5ed9b93c596c3926b6680b47de28c8ff6a8ff4b7 03-Jun-2010 Eli Friedman <eli.friedman@gmail.com> Make sure to check the accessibility of and mark the destructor for the
operand of a throw expression. Fixes PR7281.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105408 91177308-0d34-0410-b5e6-96231b3b80d8
lass.access/p4.cpp
cd7c4d8c122e7cfd6ce2a65db9e824bfe17634c2 03-Jun-2010 Jeffrey Yasskin <jyasskin@google.com> There is no dcl.init.ref p16. This test deals with p5.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105351 91177308-0d34-0410-b5e6-96231b3b80d8
cl.decl/dcl.init/dcl.init.ref/p16-cxx0x-no-extra-copy.cpp
cl.decl/dcl.init/dcl.init.ref/p5-cxx0x-no-extra-copy.cpp
c7e04dad588a30c94648b9bd70cdbe25688d7629 28-May-2010 John McCall <rjmccall@apple.com> A more minimal fix for PR6762.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104991 91177308-0d34-0410-b5e6-96231b3b80d8
asic/basic.lookup/basic.lookup.argdep/p2.cpp
2b7baf0816a40af3fde3a3e174192a549b785a50 28-May-2010 John McCall <rjmccall@apple.com> Roll back r104941.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104990 91177308-0d34-0410-b5e6-96231b3b80d8
asic/basic.lookup/basic.lookup.argdep/p2.cpp
1d0a5856d066f9030efbe3e0d9bbbb50ea597b99 28-May-2010 John McCall <rjmccall@apple.com> Add a new attribute on records, __attribute__((adl_invisible)), and define
the x86-64 __va_list_tag with this attribute. The attribute causes the
affected type to behave like a fundamental type when considered by ADL.

(x86-64 is the only target we currently provide with a struct-based
__builtin_va_list)

Fixes PR6762.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104941 91177308-0d34-0410-b5e6-96231b3b80d8
asic/basic.lookup/basic.lookup.argdep/p2.cpp
de09ed5a545bef367605f6e0cc49aa2b17049d01 28-May-2010 John McCall <rjmccall@apple.com> Test case for r104938.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104939 91177308-0d34-0410-b5e6-96231b3b80d8
asic/basic.lookup/basic.lookup.argdep/p2.cpp
76ef658c703faf72c00f324fb9edc03169718e3e 28-May-2010 Douglas Gregor <dgregor@apple.com> When we complain about a member being inaccessible due to a constraint
along an access path, add another note pointing at the member we
actually found.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104937 91177308-0d34-0410-b5e6-96231b3b80d8
lass.access/class.access.base/p1.cpp
lass.access/class.access.base/p5.cpp
lass.access/class.friend/p1.cpp
lass.access/class.protected/p1.cpp
lass.access/p4.cpp
9da9cdfd5ac5fcbb8c6a9fc38938e845e53af1ed 28-May-2010 John McCall <rjmccall@apple.com> When filtering out previous declarations of friend functions, consider the
lookup context, not the direct semantic context. Fixes PR7230.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104917 91177308-0d34-0410-b5e6-96231b3b80d8
lass.access/class.friend/p1.cpp
9f716e4140da8d18165a702f81d2286a12e83a8c 27-May-2010 Douglas Gregor <dgregor@apple.com> When we've parsed a nested-name-specifier in a member access
expression, "forget" about the object type; only the
nested-name-specifier matters for name lookup purposes. Fixes PR7239.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104834 91177308-0d34-0410-b5e6-96231b3b80d8
asic/basic.lookup/basic.lookup.qual/p6.cpp
d2235f60e7bbd9e690c05fced371df9da76adc2b 20-May-2010 Douglas Gregor <dgregor@apple.com> Reinstate r104117, Chandler Carruth's change that "[provides] a naming
class for UnresolvedLookupExprs, even when occuring on template
names" along with a fix for an Objective-C++ crasher it introduced.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104277 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.names/p2.cpp
bf1cbaf1b0ac9d967ff6abf27788cc98f0f5e7da 19-May-2010 Daniel Dunbar <daniel@zuster.org> Revert r104117, "Provide a naming class for UnresolvedLookupExprs, even when
occuring on..." which breaks some Objective-C code. Working on getting a test
case...

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104150 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.names/p2.cpp
c3f984fa13364520f4a2c447d1d213db77db3309 19-May-2010 Chandler Carruth <chandlerc@gmail.com> Provide a naming class for UnresolvedLookupExprs, even when occuring on
template names. We were completely missing naming classes for many unqualified
lookups, but this didn't trigger code paths that need it. This removes part of
an optimization that re-uses the template name lookup done by the parser to
determine if explicit template arguments actually form a template-id.
Unfortunately the technique for avoiding the duplicate lookup lost needed data
such as the class context in which the lookup succeeded.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104117 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.names/p2.cpp
238058c372cfb7bdaf489f51171eb1380ebfd6a6 18-May-2010 Douglas Gregor <dgregor@apple.com> I hate this commit.

Revert much of the implementation of C++98/03 [temp.friend]p5 in
r103943 and its follow-ons r103948 and r103952. While our
implementation was technically correct, other compilers don't seem to
implement this paragraph (which forces the instantiation of friend
functions defined in a class template when a class template
specialization is instantiated), and doing so broke a bunch of Boost
libraries.

Since this behavior has changed in C++0x (which instantiates the
friend function definitions when they are used), we're going to skip
the nowhere-implemented C++98/03 semantics and go straight to the
C++0x semantics.

This commit is a band-aid to get Boost up and running again. It
doesn't really fix PR6952 (which this commit un-fixes), but it does
deal with the way Boost.Units abuses this particular paragraph.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104014 91177308-0d34-0410-b5e6-96231b3b80d8
lass.access/class.friend/p1.cpp
emp/temp.decls/temp.friend/p4.cpp
cfe833be882f600206f1587f157b025b368497d7 17-May-2010 Douglas Gregor <dgregor@apple.com> Diagnose a redefinition error when there are two instantiations of friend
functions defined inside a class template. Fixes PR6952, the last
Boost.Units failure.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103952 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.friend/p4.cpp
6cfacfe54c75baa4d67f1fbdf4f80644b662818e 17-May-2010 Douglas Gregor <dgregor@apple.com> Determine when the instantiation of a friend function defined inside a
class template conflicts with an existing (non-template)
definition. This is another part of PR6952.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103948 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.friend/p4.cpp
ac7c2c8a9d47df7d652364af3043c41816a18fa4 17-May-2010 Douglas Gregor <dgregor@apple.com> C++98/03 [temp.friend]p4 requires that inline function definitions
within class templates be instantiated along with each class template
specialization, even if the functions are not used. Do so, as a baby
step toward PR6952.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103943 91177308-0d34-0410-b5e6-96231b3b80d8
lass.access/class.friend/p1.cpp
emp/temp.decls/temp.friend/p4.cpp
c63d2c8469d6b96712b324f76b4af07e1852313f 12-May-2010 Douglas Gregor <dgregor@apple.com> When we emit an error during the implicit definition of a special
member function (default constructor, copy constructor, copy
assignment operator, destructor), emit a note showing where that
implicit definition was required.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103619 91177308-0d34-0410-b5e6-96231b3b80d8
lass.access/p4.cpp
380c2139959d8608782292984b457640a143a70d 11-May-2010 Daniel Dunbar <daniel@zuster.org> Speculatively revert r103497, "Do not mark the virtual members of an
implicitly-instantiated class as ...", which seems to have broken bootstrap.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103515 91177308-0d34-0410-b5e6-96231b3b80d8
lass.access/p4.cpp
bbbe074566a8defed299ff676bc65b3631861768 11-May-2010 Douglas Gregor <dgregor@apple.com> Do not mark the virtual members of an implicitly-instantiated class as
referenced unless we see one of them defined (or the key function
defined, if it as one) or if we need the vtable for something. Fixes
PR7114.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103497 91177308-0d34-0410-b5e6-96231b3b80d8
lass.access/p4.cpp
2166beba8d939d2938c5401af2c8d3687afd5d8c 11-May-2010 Douglas Gregor <dgregor@apple.com> The C++98/03 standard is disturbingly silent about out-of-scope
explicit instantiations of template. C++0x clarifies the intent
(they're ill-formed in some cases; see [temp.explicit] for
details). However, one could squint at the C++98/03 standard and
conclude they are permitted, so reduce the error to a warning
(controlled by -Wc++0x-compat) in C++98/03 mode.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103482 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.spec/temp.explicit/p2.cpp
emp/temp.spec/temp.explicit/p5.cpp
ec20f46740a59758b12c22108002395bcf5b6f9b 08-May-2010 Douglas Gregor <dgregor@apple.com> When printing an overload candidate that failed due to SFINAE, print a
specific message that includes the template arguments, e.g.,

test/SemaTemplate/overload-candidates.cpp:27:20: note: candidate template
ignored: substitution failure [with T = int *]
typename T::type get_type(const T&); // expected-note{{candidate ...
^



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103348 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.fct.spec/temp.deduct/temp.deduct.type/p17.cpp
a18592ec62e898aed7ed71e1f09c314590ce9ec7 08-May-2010 Douglas Gregor <dgregor@apple.com> When template argument deduction fails because the call had too
many/too few arguments, use the same diagnostic we use for arity
mismatches in non-templates (but note that it's a function template).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103341 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.fct.spec/temp.deduct/temp.deduct.type/p17.cpp
a933319ebf754396623165f9dc0a29c2a48879f5 08-May-2010 Douglas Gregor <dgregor@apple.com> When printing a non-viable overload candidate that failed due to
conflicting deduced template argument values, give a more specific
reason along with those values, e.g.,

test/SemaTemplate/overload-candidates.cpp:4:10: note: candidate template
ignored: deduced conflicting types for parameter 'T' ('int' vs. 'long')
const T& min(const T&, const T&);
^




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103339 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.fct.spec/temp.deduct/temp.deduct.call/basic.cpp
emp/temp.fct.spec/temp.deduct/temp.deduct.call/p6.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/expr.post/expr.ref/p3.cpp
a97badf8a59368d69dea7e24b18e72c482f055a0 07-May-2010 Douglas Gregor <dgregor@apple.com> It turns out that we should be allowing redeclarations within function
scope. Thanks to Steven Watanabe for correcting me.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103210 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/basic.namespace/namespace.udecl/p8.cpp
01ebd9d1883e82c4188325900a4eb9c1e16353bb 04-May-2010 John McCall <rjmccall@apple.com> An access is permitted if the current template instantiates to the appropriate
class. Add some conservative support for the idea. Fixes PR 7024.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102999 91177308-0d34-0410-b5e6-96231b3b80d8
lass.access/p4.cpp
06a9f3680d22529a2fcf20c52d71cf221d99d910 01-May-2010 Douglas Gregor <dgregor@apple.com> Complete reimplementation of the synthesis for implicitly-defined copy
assignment operators.

Previously, Sema provided type-checking and template instantiation for
copy assignment operators, then CodeGen would synthesize the actual
body of the copy constructor. Unfortunately, the two were not in sync,
and CodeGen might pick a copy-assignment operator that is different
from what Sema chose, leading to strange failures, e.g., link-time
failures when CodeGen called a copy-assignment operator that was not
instantiation, run-time failures when copy-assignment operators were
overloaded for const/non-const references and the wrong one was
picked, and run-time failures when by-value copy-assignment operators
did not have their arguments properly copy-initialized.

This implementation synthesizes the implicitly-defined copy assignment
operator bodies in Sema, so that the resulting ASTs encode exactly
what CodeGen needs to do; there is no longer any special code in
CodeGen to synthesize copy-assignment operators. The synthesis of the
body is relatively simple, and we generate one of three different
kinds of copy statements for each base or member:

- For a class subobject, call the appropriate copy-assignment
operator, after overload resolution has determined what that is.
- For an array of scalar types or an array of class types that have
trivial copy assignment operators, construct a call to
__builtin_memcpy.
- For an array of class types with non-trivial copy assignment
operators, synthesize a (possibly nested!) for loop whose inner
statement calls the copy constructor.
- For a scalar type, use built-in assignment.

This patch fixes at least a few tests cases in Boost.Spirit that were
failing because CodeGen picked the wrong copy-assignment operator
(leading to link-time failures), and I suspect a number of undiagnosed
problems will also go away with this change.

Some of the diagnostics we had previously have gotten worse with this
change, since we're going through generic code for our
type-checking. I will improve this in a subsequent patch.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102853 91177308-0d34-0410-b5e6-96231b3b80d8
lass.access/p4.cpp
54022952450beff428a30ef5adfb82874063603d 30-Apr-2010 Douglas Gregor <dgregor@apple.com> Fix ADL for types declared in transparent decls, from Alp Toker!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102695 91177308-0d34-0410-b5e6-96231b3b80d8
asic/basic.lookup/basic.lookup.argdep/p2.cpp
516e6e09821a61e8975c787e189949723249e7c5 29-Apr-2010 Douglas Gregor <dgregor@apple.com> When performing partial ordering of class template partial
specializations, substitute the deduced template arguments and check
the resulting substitution before concluding that template argument
deduction succeeds. This marvelous little fix makes a bunch of
Boost.Spirit tests start working.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102601 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.class.spec/temp.class.order/p2.cpp
7576a65d25f3d604cec57e357b17ead8b3bbfa16 29-Apr-2010 John McCall <rjmccall@apple.com> Test case for r102578.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102580 91177308-0d34-0410-b5e6-96231b3b80d8
lass.access/p6.cpp
f5813826802c2e76cdc13cae834ebfd4518d74a6 29-Apr-2010 John McCall <rjmccall@apple.com> Properly switch into the declaring scope of a template when performing
template argument deduction or (more importantly) the final substitution
required by such deduction. Makes access control magically work in these
cases.

Fixes PR6967.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102572 91177308-0d34-0410-b5e6-96231b3b80d8
lass.access/p6.cpp
4154e0b1a5d03cbe4836e381c7d6187b7a0a200c 25-Apr-2010 Douglas Gregor <dgregor@apple.com> When we create a temporary of class type that we don't immediately
bind, check accessibility of the destructor and mark the declaration
as referenced. Fixes a bunch of Boost.Regex failures.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102287 91177308-0d34-0410-b5e6-96231b3b80d8
lass.access/p4.cpp
5cf86ba6b5a724bf91cb52feade1158f1fbeb605 24-Apr-2010 Anders Carlsson <andersca@mac.com> Actually produce base paths for CastExprs of kind CK_DerivedToBase.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102259 91177308-0d34-0410-b5e6-96231b3b80d8
cl.decl/dcl.init/dcl.init.ref/p5-examples.cpp
0d6b1640eb4d1a4a0203235cfdfcdaf3335af36d 23-Apr-2010 John McCall <rjmccall@apple.com> Recommit my change to how C++ does elaborated type lookups, now with
two bugfixes which fix selfhost and (hopefully) the nightly tests.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102198 91177308-0d34-0410-b5e6-96231b3b80d8
asic/basic.lookup/basic.lookup.elab/p2.cpp
lass.access/class.friend/p1.cpp
emp/temp.decls/temp.friend/p1.cpp
00b40d3f2fb8b2f9043daf3dd4558bff98346b3c 23-Apr-2010 Daniel Dunbar <daniel@zuster.org> Revert "C++ doesn't really use "namespaces" for different kinds of names the same", which seems to break most C++ nightly test apps.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102174 91177308-0d34-0410-b5e6-96231b3b80d8
asic/basic.lookup/basic.lookup.elab/p2.cpp
lass.access/class.friend/p1.cpp
emp/temp.decls/temp.friend/p1.cpp
d04efc98d08731e31bd73f430803acc5ffa9040a 23-Apr-2010 John McCall <rjmccall@apple.com> C++ doesn't really use "namespaces" for different kinds of names the same
way that C does. Among other differences, elaborated type specifiers
are defined to skip "non-types", which, as you might imagine, does not
include typedefs. Rework our use of IDNS masks to capture the semantics
of different kinds of declarations better, and remove most current lookup
filters. Removing the last remaining filter is more complicated and will
happen in a separate patch.

Fixes PR 6885 as well some spectrum of unfiled bugs.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102164 91177308-0d34-0410-b5e6-96231b3b80d8
asic/basic.lookup/basic.lookup.elab/p2.cpp
lass.access/class.friend/p1.cpp
emp/temp.decls/temp.friend/p1.cpp
d1aa800a19c956c72319025dd302ae78ed47f9ee 23-Apr-2010 Anders Carlsson <andersca@mac.com> Change the 'declared at' diagnostic to say 'declared here'.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102163 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/basic.namespace/namespace.udecl/p4.cpp
050b78acf11900cb8c47563376200a1d7bd97f59 22-Apr-2010 Douglas Gregor <dgregor@apple.com> Record nested-name-specifiers of when we create
elaborated-type-specifiers. Patch by Enea Zaffanella!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102065 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/basic.namespace/namespace.udecl/p1.cpp
a41a8c5972c2632247ae7913cf6ce65d45f7e702 22-Apr-2010 Douglas Gregor <dgregor@apple.com> Whenever we complain about a failed initialization of a function or
method parameter, provide a note pointing at the parameter itself so
the user does not have to manually look for the function/method being
called and match up parameters to arguments. For example, we now get:

t.c:4:5: warning: incompatible pointer types passing 'long *' to
parameter of
type 'int *' [-pedantic]
f(long_ptr);
^~~~~~~~
t.c:1:13: note: passing argument to parameter 'x' here
void f(int *x);
^



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102038 91177308-0d34-0410-b5e6-96231b3b80d8
asic/basic.lookup/basic.lookup.qual/namespace.qual/p2.cpp
cl.dcl/basic.namespace/namespace.udecl/p1.cpp
cl.decl/dcl.meaning/dcl.fct.default/p5.cpp
711f34adb886cce8ba86c7b1b6513a1eaaf63bb5 21-Apr-2010 Anders Carlsson <andersca@mac.com> Keep tack of whether a base in an InitializedEntity is an inherited virtual base or not. Use this in CheckConstructorAccess.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102020 91177308-0d34-0410-b5e6-96231b3b80d8
lass.access/p4.cpp
9a68a67c6ae4982001815cc04f69b8781058263a 21-Apr-2010 Anders Carlsson <andersca@mac.com> Pass the InitializedEntity to Sema::CheckConstructorAccess and use it to report different diagnostics depending on which entity is being initialized.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102010 91177308-0d34-0410-b5e6-96231b3b80d8
lass.access/p4.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/expr.unary/expr.new/p19.cpp
xpr/expr.unary/expr.new/p20-0x.cpp
xpr/expr.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/expr.unary/expr.new/p19.cpp
xpr/expr.unary/expr.new/p20-0x.cpp
xpr/expr.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/expr.unary/expr.new/p19.cpp
xpr/expr.unary/expr.new/p20-0x.cpp
xpr/expr.unary/expr.new/p20.cpp
a77eaa9f4562dc611aa121a20ee8f2e2146765ce 18-Apr-2010 Douglas Gregor <dgregor@apple.com> Make sure that we don't visit redeclarations of nested classes while
instantiating class members as part of an explicit
instantiation. Addresses a compilation problem in
Boost.Serialization.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101725 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.spec/p5.cpp
c1c9df77c098a651b56db3052ed174a47cbde5b6 18-Apr-2010 Douglas Gregor <dgregor@apple.com> C++ [namespace.memdef]p3 only applies when the friend is not named via
a qualified name. We weren't checking for an empty
nested-name-specifier when dealing with friend class templates
(although we were checking in the other places where we deal with this
paragraph). Fixes a Boost.Serialization showstopper.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101724 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/basic.namespace/namespace.def/namespace.memdef/p3.cpp
630eb01b2568d0958118eb1a0ded02bebecb2b0f 18-Apr-2010 Chandler Carruth <chandlerc@gmail.com> Fix the access checking of function and function template argument types,
return types, and default arguments. This fixes PR6855 along with several
similar cases where we rejected valid code.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101706 91177308-0d34-0410-b5e6-96231b3b80d8
lass.access/class.friend/p1.cpp
2559a7045a74679c80376305397a5953d038e1d0 18-Apr-2010 Douglas Gregor <dgregor@apple.com> When checking the copy constructor for the optional copy during a
reference binding to an rvalue of reference-compatible type, check
parameters after the first for complete parameter types and build any
required default function arguments. We're effectively simulating the
type-checking for a call without building the call itself.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101705 91177308-0d34-0410-b5e6-96231b3b80d8
cl.decl/dcl.init/dcl.init.ref/p16-cxx0x-no-extra-copy.cpp
cl.decl/dcl.init/dcl.init.ref/p5-cxx03-extra-copy.cpp
523d46af407f32fc53861e6f068e8076d4fe84a8 18-Apr-2010 Douglas Gregor <dgregor@apple.com> In C++98/03, when binding a reference to an rvalue of
reference-compatible type, the implementation is permitted to make a
copy of the rvalue (or many such copies, even). However, even though
we don't make that copy, we are required to check for the presence of
a suitable copy constructor. With this change, we do.

Note that in C++0x we are not allowed to make these copies, so we test
both dialects separately.

Also note the FIXME in one of the C++03 tests, where we are not
instantiating default function arguments for the copy constructor we
pick (but do not call). The fix is obvious; eliminating the infinite
recursion it causes is not. Will address that next.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101704 91177308-0d34-0410-b5e6-96231b3b80d8
cl.decl/dcl.init/dcl.init.ref/p16-cxx0x-no-extra-copy.cpp
cl.decl/dcl.init/dcl.init.ref/p5-cxx03-extra-copy.cpp
c0b39640de335809ca7544f802751112619f30cc 16-Apr-2010 Douglas Gregor <dgregor@apple.com> Audit uses of Sema::LookupSingleName for those lookups that are
intended for redeclarations, fixing those that need it. Fixes PR6831.

This uncovered an issue where the C++ type-specifier-seq parsing logic
would try to perform name lookup on an identifier after it already had
a type-specifier, which could also lead to spurious ambiguity errors
(as in PR6831, but with a different test case).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101419 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.param/p3.cpp
325e593a83b20d9bce3628aa78fda983b554814e 15-Apr-2010 Douglas Gregor <dgregor@apple.com> Warn about non-aggregate classes with no user-declared constructors
that have reference or const scalar members, since those members can
never be initializer or modified. Fixes <rdar://problem/7804350>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101316 91177308-0d34-0410-b5e6-96231b3b80d8
cl.decl/dcl.meaning/dcl.ref/p5.cpp
74256f5ea6950c9fd34595aa124eb4740372f15c 14-Apr-2010 John McCall <rjmccall@apple.com> Parse friend template ids as types instead of ending up in
ActOnClassTemplateSpecialization and being very confused.
Fixes PR6514 (for non-templated-scope friends).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101198 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.friend/p1.cpp
21c0160959961b3a6ab3308608ee3fde182ecb49 14-Apr-2010 John McCall <rjmccall@apple.com> Fix an embarrasing memory error. I was apparently very tired when I wrote this
code the first time.

Fixes PR6827.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101184 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.friend/p1.cpp
77e8b11524187f81548450e9e2ad9dd0e7200909 13-Apr-2010 John McCall <rjmccall@apple.com> Support befriending members of class template specializations.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101173 91177308-0d34-0410-b5e6-96231b3b80d8
lass.access/class.friend/p1.cpp
d1fed3e8595a15edd7e14cee166ef90634fcf141 13-Apr-2010 Douglas Gregor <dgregor@apple.com> During referencing binding, only consider conversion functions for
direct reference binding when the source and target types are not
reference-related. Fixes PR6066.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101132 91177308-0d34-0410-b5e6-96231b3b80d8
cl.decl/dcl.init/dcl.init.ref/p5.cpp
3d04336baf091b16e9d8f85b48b82dafd2695874 13-Apr-2010 John McCall <rjmccall@apple.com> Allow classes to befriend implicitly-declared members. Fixes PR6207 for
members of non-templated classes.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101122 91177308-0d34-0410-b5e6-96231b3b80d8
lass.access/class.friend/p1.cpp
9ea6397bf4ff53768ef4bdc0945965103a22e98c 13-Apr-2010 John McCall <rjmccall@apple.com> Don't try to find a scope corresponding to the search DC for an unfound
friend declaration; this used to be important but is now just a waste of time
plus an unreasonable assertion. Fixes PR6174.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101112 91177308-0d34-0410-b5e6-96231b3b80d8
lass.access/class.friend/p1.cpp
c520c84f7e9c2d8d4a66ac438e10d815daaeae64 13-Apr-2010 Douglas Gregor <dgregor@apple.com> Implement C++ [over.ics.user]p3, which restricts the final conversion
from a conversion function template specialization to one of exact
match rank. We only know how to test this in C++0x with default
function template arguments, but it's also in the C++03 spec. Fixes
PR6285.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101089 91177308-0d34-0410-b5e6-96231b3b80d8
ver/over.match/over.match.best/over.best.ics/over.ics.user/p3-0x.cpp
01e56aecb77a96dcd93fa0e901b919f2e441981d 12-Apr-2010 Douglas Gregor <dgregor@apple.com> Implement C++ [temp.local]p4, which specifies how we eliminate
name-lookup ambiguities when there are multiple base classes that are
all specializations of the same class template. This is part of a
general cleanup for ambiguities in template-name lookup. Fixes
PR6717.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101065 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.res/temp.local/p3.cpp
57265e35292897e383d70bbd1d552209fac37b39 12-Apr-2010 Douglas Gregor <dgregor@apple.com> Fix a crash-on-invalid involving name lookup of tag names, where we
ended up finding a function template that we didn't expect. Recover
more gracefully, and fix a similar issue for class templates.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101040 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.mem/p1.cpp
966c78b79004061c1f64feff96818b9f1d68ea58 12-Apr-2010 Chris Lattner <sabre@nondot.org> change Scope::WithinElse to be a normal scope flag, widen the
fields to two 16-bit values instead of using bitfields.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101020 91177308-0d34-0410-b5e6-96231b3b80d8
tmt.stmt/stmt.select/p3.cpp
c42b6520b607cda57e850a60143e9f98bf421dbb 09-Apr-2010 Douglas Gregor <dgregor@apple.com> Only complain about explicit instantiations following explicit
specializations when the explicit instantiation was... explicitly
written, i.e., not the product of an explicit instantiation of an
enclosing class. Fixes this spurious warning when Clang builds LLVM:

/Volumes/Data/dgregor/Projects/llvm/lib/CodeGen/MachineDominators.cpp:22:1:
warning: explicit instantiation of 'addRoot' that occurs after an
explicit specialization will be ignored (C++0x extension) [-pedantic]



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100900 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.spec/temp.explicit/p4.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
lass.access/class.access.base/p1.cpp
lass.access/class.access.base/p5.cpp
lass.access/class.access.nest/p1.cpp
lass.access/class.friend/p1.cpp
lass.access/class.protected/p1.cpp
lass.access/p4.cpp
lass.access/p6.cpp
lass/class.local/p2.cpp
lass/class.mfct/class.mfct.non-static/p3.cpp
onv/conv.mem/p4.cpp
cl.dcl/basic.namespace/namespace.udecl/p1.cpp
cl.decl/dcl.meaning/dcl.fct.default/p6.cpp
xpr/expr.unary/expr.delete/p5.cpp
emp/temp.decls/temp.class.spec/temp.class.order/p2.cpp
emp/temp.decls/temp.friend/p1.cpp
emp/temp.spec/temp.inst/p11.cpp
6cd3b9fb8a29bb70fff01719bdde238723d67c10 09-Apr-2010 John McCall <rjmccall@apple.com> Instantiate default argument expressions even if their associated parameter
type isn't dependent. Fixes rdar://problem/7838962.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100871 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.spec/temp.inst/p11.cpp
d4eea8362605807327735727a9098abe1eb23b19 09-Apr-2010 Douglas Gregor <dgregor@apple.com> Improve diagnostics when we fail to convert from a source type to a
destination type for initialization, assignment, parameter-passing,
etc. The main issue fixed here is that we used rather confusing
wording for diagnostics such as

t.c:2:9: warning: initializing 'char const [2]' discards qualifiers,
expected 'char *' [-pedantic]
char *name = __func__;
^ ~~~~~~~~

We're not initializing a 'char const [2]', we're initializing a 'char
*' with an expression of type 'char const [2]'. Similar problems
existed for other diagnostics in this area, so I've normalized them all
with more precise descriptive text to say what we're
initializing/converting/assigning/etc. from and to. The warning for
the code above is now:

t.c:2:9: warning: initializing 'char *' from an expression of type
'char const [2]' discards qualifiers [-pedantic]
char *name = __func__;
^ ~~~~~~~~

Fixes <rdar://problem/7447179>.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100832 91177308-0d34-0410-b5e6-96231b3b80d8
xcept/except.handle/p16.cpp
ea7390c7b384ce607bfc8fc13c01f37cfc3776f0 08-Apr-2010 John McCall <rjmccall@apple.com> Set access properly on instantiated friend class template declarations.
Fixes PR6752.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100806 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.friend/p1.cpp
9ab14541716928894821cf5d53d6b4c95ffdf3a3 08-Apr-2010 Jeffrey Yasskin <jyasskin@google.com> Make CXXScopeSpec invalid when incomplete, and propagate that into any
Declarator that depends on it. This fixes several redundant errors and bad
recoveries.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100779 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.spec/temp.explicit/p3.cpp
af2094e7cecadf36667deb61a83587ffdd979bd3 08-Apr-2010 John McCall <rjmccall@apple.com> Implement dependent friend function template specializations.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100753 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.friend/p1.cpp
db88d8ad74097e2601d81ee863ce46a8a48a7034 08-Apr-2010 Jeffrey Yasskin <jyasskin@google.com> When a template (without arguments) is passed as a template type
parameter, explicitly ask the user to give it arguments. We used to
complain that it wasn't a type and expect the user to figure it out.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100729 91177308-0d34-0410-b5e6-96231b3b80d8
asic/basic.lookup/basic.lookup.unqual/p7.cpp
06245bfb3ae40bb24a8bfb17eafeb266a4daf5ca 07-Apr-2010 Douglas Gregor <dgregor@apple.com> Improve handling of friend types in several ways:
- When instantiating a friend type template, perform semantic
analysis on the resulting type.
- Downgrade the errors concerning friend type declarations that do
not refer to classes to ExtWarns in C++98/03. C++0x allows
practically any type to be befriended, and ignores the friend
declaration if the type is not a class.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100635 91177308-0d34-0410-b5e6-96231b3b80d8
lass.access/class.friend/p2-cxx03.cpp
lass.access/class.friend/p3-cxx0x.cpp
lass/class.friend/p2.cpp
cl.dcl/dcl.spec/dcl.type/dcl.type.elab/p3.cpp
emp/temp.decls/temp.friend/p3.cpp
c91cc66e92b084acd1fdbaa1c3c74242741b3d46 07-Apr-2010 John McCall <rjmccall@apple.com> Check access for the implicit calls to destructors that occur when we
have a temporary object in C++.

Also fix a tag mismatch that Doug noticed.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100593 91177308-0d34-0410-b5e6-96231b3b80d8
lass.access/p4.cpp
161755a09898c95d21bfff33707da9ca41cd53c5 06-Apr-2010 John McCall <rjmccall@apple.com> Implement the protected access restriction ([class.protected]), which requires
that protected members be used on objects of types which derive from the
naming class of the lookup. My first N attempts at this were poorly-founded,
largely because the standard is very badly worded here.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100562 91177308-0d34-0410-b5e6-96231b3b80d8
lass.access/class.protected/p1.cpp
7bbe5f6bfc2e9c79c7c692a1cf03de56662aa14b 02-Apr-2010 John McCall <rjmccall@apple.com> Check in a motivating test for the revised access semantics.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100159 91177308-0d34-0410-b5e6-96231b3b80d8
lass.access/class.access.base/p5.cpp
db73c684ba61fed4087af488e8610657ec638c17 02-Apr-2010 John McCall <rjmccall@apple.com> Correct the calculation of access to more closely model the wording in
the standard.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100155 91177308-0d34-0410-b5e6-96231b3b80d8
lass.access/class.access.base/p5.cpp
b7a09260204f2079e0f998bf7ee52b95122a4c5d 01-Apr-2010 Douglas Gregor <dgregor@apple.com> Overhaul checking of non-type template arguments that should refer to
an object or function. Our previous checking was too lax, and ended up
allowing missing or extraneous address-of operators, among other
evils. The new checking provides better diagnostics and adheres more
closely to the standard.

Fixes PR6563 and PR6749.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100125 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.arg/temp.arg.nontype/p1.cpp
emp/temp.arg/temp.arg.nontype/p5.cpp
emp/temp.res/temp.local/p1.cpp
1eabb7d0c30f6a876b0fd03ad4656c096c26b8d0 01-Apr-2010 Douglas Gregor <dgregor@apple.com> Improve diagnostics when an elaborated-type-specifer containing a
nested-name-specifier (e.g., "class T::foo") fails to find a tag
member in the scope nominated by the
nested-name-specifier. Previously, we gave a bland

error: 'Nested' does not name a tag member in the specified scope

which didn't actually say where we were looking, which was rather
horrible when the nested-name-specifier was instantiated. Now, we give
something a bit better:

error: no class named 'Nested' in 'NoDepBase<T>'




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100060 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/dcl.spec/dcl.type/dcl.type.elab/p3.cpp
4033642464e8ba0982f88f34cffad808d247b393 01-Apr-2010 Douglas Gregor <dgregor@apple.com> Change the representation of dependent elaborated-type-specifiers
(such as "class T::foo") from an ElaboratedType of a TypenameType to a
DependentNameType, which more accurately models the underlying
concept.

Improve template instantiation for DependentNameType nodes that
represent nested-name-specifiers, by performing tag name lookup and
checking the resulting tag appropriately. Fixes PR5681.

There is still much testing and cleanup to do in this area.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100054 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/dcl.spec/dcl.type/dcl.type.elab/p3.cpp
32daa4223ccb2c0afe5fbe151c6eb1ab64816957 31-Mar-2010 John McCall <rjmccall@apple.com> Regularize support for naming conversion functions in using decls.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99979 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/basic.namespace/namespace.udecl/p1.cpp
3be9678105f10c49c4ebc5ce353f770c3a50f9c7 31-Mar-2010 Douglas Gregor <dgregor@apple.com> Add a test for C++ [stmt.select]p3, which specifies that redeclaring a
name in the outermost block of a if/else that declares the same name
is ill-formed. Turns out that Clang and MSVC were right about PR6739;
GCC is too lax.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99937 91177308-0d34-0410-b5e6-96231b3b80d8
tmt.stmt/stmt.select/p3.cpp
6bb8017bb9e828d118e15e59d71c66bba323c364 30-Mar-2010 John McCall <rjmccall@apple.com> Propagate the "found declaration" (i.e. the using declaration instead of
the underlying/instantiated decl) through a lot of API, including "intermediate"
MemberExprs required for (e.g.) template instantiation. This is necessary
because of the access semantics of member accesses to using declarations:
only the base class *containing the using decl* need be accessible from the
naming class.

This allows us to complete an access-controlled selfhost, if there are no
recent regressions.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99936 91177308-0d34-0410-b5e6-96231b3b80d8
lass.access/p4.cpp
02024a9f0d8e6c898de276193af604c42ee41269 28-Mar-2010 Douglas Gregor <dgregor@apple.com> After performing template argument deduction for a function template,
check deduced non-type template arguments and template template
arguments against the template parameters for which they were deduced,
performing conversions as appropriate so that deduced template
arguments get the same treatment as explicitly-specified template
arguments. This is the bulk of PR6723.

Also keep track of whether deduction of a non-type template argument
came from an array bound (vs. anywhere else). With this information,
we enforce C++ [temp.deduct.type]p17, which requires exact type
matches when deduction deduces a non-type template argument from
something that is not an array bound.

Finally, when in a SFINAE context, translate the "zero sized
arrays are an extension" extension diagnostic into a hard error (for
better standard conformance), which was a minor part of PR6723.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99734 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.fct.spec/temp.deduct/temp.deduct.type/p17.cpp
2cc2675d426af23476a9722c08c1b6c5266bd653 27-Mar-2010 John McCall <rjmccall@apple.com> Accumulate all functions and classes that the effective context is
nested within, and suddenly local classes start working. Wouldn't be
necessary if I hadn't used local classes in Clang in the first place.
Or, well, wouldn't be necessary yet. :)



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99709 91177308-0d34-0410-b5e6-96231b3b80d8
lass.access/p4.cpp
b0cb022daec8671406ab25f4b5d5a6d48d823bc4 27-Mar-2010 John McCall <rjmccall@apple.com> Implement method friends in class templates and fix a few related problems.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99708 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.friend/p1.cpp
b1a56e767cfb645fcb25027ab728dd5824d92615 27-Mar-2010 John McCall <rjmccall@apple.com> Put function templates instantiated from friend declarations in the correct
lexical context. This is required for ADL to work properly; fixes PR6716.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99665 91177308-0d34-0410-b5e6-96231b3b80d8
asic/basic.lookup/basic.lookup.argdep/p4.cpp
7c3745af0a171bd62605177e53fc0fce3ff6ab25 26-Mar-2010 Gabor Greif <ggreif@gmail.com> add a slight variation of test3, where
argument list seems to be different, but in fact
is semantically equivalent; check that we do not error here

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99617 91177308-0d34-0410-b5e6-96231b3b80d8
lass.access/class.friend/p1.cpp
9c127392efe91dadacbe28ca16b8a9a5fa7990b3 26-Mar-2010 Douglas Gregor <dgregor@apple.com> Do not mark the destructor of a function parameter's type. Fixes PR6709.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99615 91177308-0d34-0410-b5e6-96231b3b80d8
lass.access/p4.cpp
4a0bac96103ba9f1528e91a26c0be457d39cec0f 26-Mar-2010 Douglas Gregor <dgregor@apple.com> Add tests for PR6707.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99613 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.fct.spec/temp.deduct/p9.cpp
d325daa506338ab86f9dd468b48fd010673f49a6 26-Mar-2010 John McCall <rjmccall@apple.com> Reapply r99596 with a fix: link an instantiated friend function to its
pattern if it has a body.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99610 91177308-0d34-0410-b5e6-96231b3b80d8
lass.access/class.friend/p1.cpp
emp/temp.decls/temp.friend/p1.cpp
a7bc8559b40a78d664d6c7faf4b42ff21184c146 26-Mar-2010 John McCall <rjmccall@apple.com> Apparently that didn't work. Reverting for now.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99601 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.friend/p1.cpp
1a6e03457ebafd6ac523cdcf5d6b6f411ea08772 26-Mar-2010 Douglas Gregor <dgregor@apple.com> Reinstate change to non-type template arguments of integral type, so
that we extend/truncate then correct the sign to convert the non-type
template argument to the template parameter's type. Previously, we
reported an error when the non-type template argument was out of
range; now we just warn.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99600 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.fct.spec/temp.deduct/p9.cpp
d7e29e114d20da5b83e0cb7bc29ec717a7458cb1 26-Mar-2010 John McCall <rjmccall@apple.com> Properly instantiate and link in friend function templates.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99596 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.friend/p1.cpp
0d4fd8ef35ecd73ce6388cb5a6fdcfb15171f5aa 26-Mar-2010 Douglas Gregor <dgregor@apple.com> Revert attempted fix for integral template arguments. It seems to have broken tramp3d-v4.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99583 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.fct.spec/temp.deduct/p9.cpp
684d096c204c5eef29c10777bce890400d235d8c 25-Mar-2010 Douglas Gregor <dgregor@apple.com> Warn when the conversion of an integral non-type template argument to
the type of its corresponding non-type template parameter changes the
value. Previously, we were diagnosing this as an error, which was
wrong. We give reasonably nice warnings like:

test/SemaTemplate/temp_arg_nontype.cpp:100:10: warning: non-type template
argument value '256' truncated to '0' for template parameter of type
'unsigned char'
Overflow<256> *overflow3; // expected-warning{{non-type template ...
^~~
test/SemaTemplate/temp_arg_nontype.cpp:96:24: note: template parameter is
declared here
template<unsigned char C> struct Overflow;
^



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99561 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.fct.spec/temp.deduct/p9.cpp
90f97892eb8b2ecfcf633c9df01e2504686d4d96 25-Mar-2010 John McCall <rjmccall@apple.com> When finishing a function definition, leave the function definition *after*
doing all the cleanup tasks and checks. This gives us the proper context for
checking access to base and member destructors.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99559 91177308-0d34-0410-b5e6-96231b3b80d8
lass.access/p4.cpp
e06c1a13172bd6ef38fe927d72198ab3f97c0b4a 25-Mar-2010 John McCall <rjmccall@apple.com> Fix a very minor oversight in privileges-elevation: we were only considering
friendship for a derived class if the base class specifier was non-public,
and thus not considering friendship for non-public members of public bases.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99554 91177308-0d34-0410-b5e6-96231b3b80d8
lass.access/class.friend/p1.cpp
9c86b513cb42ea6d9e3f98cb2b7eda39a2eb526b 25-Mar-2010 John McCall <rjmccall@apple.com> Handle simple friend-class decls in class templates better by ensuring that
we look for shadow friend decls in the appropriate scope before injecting
a new declaration.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99552 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.friend/p1.cpp
93ba8579c341d5329175f1413cdc3b35a36592d2 25-Mar-2010 John McCall <rjmccall@apple.com> Properly instantiate friend class template declarations and link them into
the redeclaration chain. Recommitted from r99477 with a fix: we need to
merge in default template arguments from previous declarations.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99496 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.friend/p1.cpp
e131c574c7baa28eb0759181478d710a2aa60cb6 25-Mar-2010 Bob Wilson <bob.wilson@apple.com> Revert 99477 since it appears to be breaking the clang-x86_64-darwin10-fnt
buildbot. The tramp3d test fails.
--- Reverse-merging r99477 into '.':
U test/SemaTemplate/friend-template.cpp
U test/CXX/temp/temp.decls/temp.friend/p1.cpp
U lib/Sema/SemaTemplateInstantiateDecl.cpp
U lib/Sema/SemaAccess.cpp


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99481 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.friend/p1.cpp
a56623b01ed9f28f10416432d147c7a1729d5f1d 25-Mar-2010 John McCall <rjmccall@apple.com> Properly instantiate and link in friend-class-template declarations.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99477 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.friend/p1.cpp
036ada215d2c53e6a286b42d7cbd2386b0007516 24-Mar-2010 Douglas Gregor <dgregor@apple.com> Silently drop dependent friend function template specializations,
since we have absolutely no way to match them when they are declared
nor do we have a way to represent these parsed-but-not-checked friend
declarations.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99407 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.friend/p1.cpp
c1b621daf98d83075a466c6f4ad9904dc845dd09 24-Mar-2010 John McCall <rjmccall@apple.com> Walk out of enums when determining effective context.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99391 91177308-0d34-0410-b5e6-96231b3b80d8
lass.access/p4.cpp
7ad650f88ecbbe659f10f9f6b34a1f29ea9cf8f9 24-Mar-2010 John McCall <rjmccall@apple.com> Support friend function specializations.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99389 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.friend/p1.cpp
emp/temp.spec/temp.expl.spec/p20.cpp
2eef829b19bdc59976a827fa39b409440e352bff 24-Mar-2010 Douglas Gregor <dgregor@apple.com> When a declaration of a function is missing an exception specification
that was present in a prior declaration, emit a warning rather than a
hard error (which we did before, and still do with mismatched
exception specifications). Moreover, provide a fix-it hint with the
throw() clause that should be added, e.g.,

t.C:10:7: warning: 'operator new' is missing exception specification
'throw(std::bad_alloc)'
void *operator new(unsigned long sz)
^
throw(std::bad_alloc)

As part of this, disable the warning when we're missing an exception
specification on operator new, operator new[], operator delete, or
operator delete[] when exceptions are turned off (-fno-exceptions).

Fixes PR5957.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99388 91177308-0d34-0410-b5e6-96231b3b80d8
asic/basic.stc/basic.stc.dynamic/p2-noexceptions.cpp
asic/basic.stc/basic.stc.dynamic/p2.cpp
0c01d18094100db92d38daa923c95661512db203 24-Mar-2010 John McCall <rjmccall@apple.com> Implement a framework for the delay of arbitrary diagnostics within
templates. So delay access-control diagnostics when (for example) the target
of a friend declaration is a specific specialization of a template.

I was surprised to find that this was required for an access-controlled selfhost.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99383 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.friend/p1.cpp
7b2fc9d3c97f2526528a8b686af1589054025ca0 24-Mar-2010 Douglas Gregor <dgregor@apple.com> Implement computation of the final overriders for each virtual
function within a class hierarchy (C++ [class.virtual]p2).

We use the final-overrider computation to determine when a particular
class is ill-formed because it has multiple final overriders for a
given virtual function (e.g., because two virtual functions override
the same virtual function in the same virtual base class). Fixes
PR5973.

We also use the final-overrider computation to determine which virtual
member functions are pure when determining whether a class is
abstract or diagnosing the improper use of an abstract class. The
prior approach to determining whether there were any pure virtual
functions in a class didn't cope with virtual base class subobjects
properly, and could not easily be fixed to deal with the oddities of
subobject hiding. Fixes PR6631.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99351 91177308-0d34-0410-b5e6-96231b3b80d8
lass.derived/class.abstract/p4.cpp
lass.derived/class.abstract/p5.cpp
lass.derived/class.virtual/p2.cpp
73061d054128e486e70e0f2874b23d6eca067e5b 19-Mar-2010 John McCall <rjmccall@apple.com> Pretty-print anonymous types using their kind and presumed location.
Fixes PR6643. Patch by Mike M!



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98946 91177308-0d34-0410-b5e6-96231b3b80d8
lass/class.union/p1.cpp
7aceaf8cee77c98478e8934dc283910292711a7e 19-Mar-2010 John McCall <rjmccall@apple.com> When elevating access along an inheritance path, initialize the computed
access to the (elevated) access of the accessed declaration, if applicable,
rather than plunking that access onto the end after we've calculated the
inheritance access.

Also, being a friend of a derived class gives you public access to its
members (subject to later modification by further inheritance); it does
not simply ignore a single location of restricted inheritance.

Also, when computing the best unprivileged path to a subobject, preserve
the information that the worst path might be AS_none (forbidden) rather
than a minimum of AS_private.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98899 91177308-0d34-0410-b5e6-96231b3b80d8
lass.access/class.friend/p1.cpp
lass.access/p4.cpp
90c8c57bcd84083df85f76aac2aa62acb85eb077 18-Mar-2010 John McCall <rjmccall@apple.com> from code inspection, we were treating placement news with one argument as
non-placement news when selecting the corresponding operator delete; this is
fixed.
Access and ambiguity control for calls to operator new and delete. Also AFAICT



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98818 91177308-0d34-0410-b5e6-96231b3b80d8
lass.access/p4.cpp
10f2873c0df7f662bfdb9a3e8bc834b68c1ead48 18-Mar-2010 John McCall <rjmccall@apple.com> Redeclaration lookups for parameter names should be flagged as redeclaration lookups
so they don't trigger diagnostics like (say) access control.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98806 91177308-0d34-0410-b5e6-96231b3b80d8
lass.access/p4.cpp
a742db0032d8f458fe229600d2082981a1fb1481 17-Mar-2010 John McCall <rjmccall@apple.com> Implement non-dependent friend functions and classes.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98764 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.friend/p1.cpp
88b6c71e3f0e68d094efcf880910caf424b46cbf 17-Mar-2010 John McCall <rjmccall@apple.com> Grant nested classes the access privileges of their enclosing classes.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98710 91177308-0d34-0410-b5e6-96231b3b80d8
lass.access/class.access.nest/p1.cpp
ef027fe748894522653558d9475a220482395094 16-Mar-2010 John McCall <rjmccall@apple.com> Perform access control for the implicit calls to base and member destructors
that occur in constructors (on the unwind path).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98681 91177308-0d34-0410-b5e6-96231b3b80d8
lass.access/p4.cpp
b020748a9954c995f2e616f50bb9ed4fe2df1f72 16-Mar-2010 John McCall <rjmccall@apple.com> Access control for implicit calls to copy assignment operators and copy
constructors from implicitly-defined members.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98614 91177308-0d34-0410-b5e6-96231b3b80d8
lass.access/p4.cpp
6c790eac94101407acfd2c664400924cab45c0b1 16-Mar-2010 John McCall <rjmccall@apple.com> Perform access control even for the implicit destructor calls from implicit
destructor definitions. Remove some code duplication.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98611 91177308-0d34-0410-b5e6-96231b3b80d8
lass.access/p4.cpp
58e6f34e4d2c668562e1c391162ee9de7b05fbb2 16-Mar-2010 John McCall <rjmccall@apple.com> Perform access control for the implicit base and member destructor calls
required when emitting a destructor definition.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98609 91177308-0d34-0410-b5e6-96231b3b80d8
lass.access/p4.cpp
dbdf5e7d0b6f1f8d8c496c1a0ada6f706cddf100 15-Mar-2010 Douglas Gregor <dgregor@apple.com> During C++ name lookup, use DeclContext::Equals() rather than
comparing DeclContext pointers, to avoid having to remember to call
getPrimaryContext() everywhere. This is the last part PR6594.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98546 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.res/temp.local/p8.cpp
711be1e89a56cdf679143ad18afaa58ed59f0584 15-Mar-2010 Douglas Gregor <dgregor@apple.com> Implement C++ [temp.local]p8, which specifies that a template
parameter hides a namespace-scope declararion with the same name in an
out-of-line definition of a template. The lookup requires a strange
interleaving of lexical and semantic scopes (go C++), which I have not
yet handled in the typo correction/code completion path.

Fixes PR6594.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98544 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.res/temp.local/p7.cpp
emp/temp.res/temp.local/p8.cpp
emp/temp.res/temp.local/p9.cpp
b05b5f35f114505182b076aa70002843c0669beb 15-Mar-2010 John McCall <rjmccall@apple.com> Remember access paths for visible conversion decls.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98539 91177308-0d34-0410-b5e6-96231b3b80d8
lass.access/p4.cpp
8f51a4f2d00b0abda3cde7f3828fb2e2b9beafb5 13-Mar-2010 Douglas Gregor <dgregor@apple.com> Give explicit template instantiations weak ODR linkage. Former
iterations of this patch gave explicit template instantiation
link-once ODR linkage, which permitted the back end to eliminate
unused symbols. Weak ODR linkage still requires the symbols to be
generated.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98441 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.spec/temp.explicit/p1-emit.cpp
34fd284e0a6ea88b98d6e1183548264bab5b3702 13-Mar-2010 Douglas Gregor <dgregor@apple.com> Re-revert the explicit template instantiation linkage patch. I am beginning to look incompetent

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98425 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.spec/temp.explicit/p1-emit.cpp
8721360da5cf3d5dfdc2fc2bf8d53a5f79307995 13-Mar-2010 Douglas Gregor <dgregor@apple.com> Reinstate patch to turn explicit template instantiations into weak symbols

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98424 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.spec/temp.explicit/p1-emit.cpp
4ea9006629acb6bf9b2984554517c968a10a6b77 12-Mar-2010 Douglas Gregor <dgregor@apple.com> Revert the linkage change for explicit template instantiations; something is amiss

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98332 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.spec/temp.explicit/p1-emit.cpp
e5e0c9deb1b4cfa081152cda548d31368facbc57 12-Mar-2010 Douglas Gregor <dgregor@apple.com> Give explicit template instantiations weak linkage (but don't defer
them). Fixes PR6578.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98328 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.spec/temp.explicit/p1-emit.cpp
ceef4ce492c6725180438da69e6621fa0833f523 12-Mar-2010 John McCall <rjmccall@apple.com> Add an extra test to this test-case.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98322 91177308-0d34-0410-b5e6-96231b3b80d8
lass.access/class.friend/p1.cpp
d60e22e601852ae1345f01514318a0951dc09f89 12-Mar-2010 John McCall <rjmccall@apple.com> Implement basic support for friend types and functions in non-dependent
contexts.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98321 91177308-0d34-0410-b5e6-96231b3b80d8
lass.access/class.friend/p1.cpp
7c2342dd4c9947806842e5aca3d2bb2e542853c9 10-Mar-2010 John McCall <rjmccall@apple.com> When pretty-printing tag types, only print the tag if we're in C (and
therefore not creating ElaboratedTypes, which are still pretty-printed
with the written tag).

Most of these testcase changes were done by script, so don't feel too
sorry for my fingers.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98149 91177308-0d34-0410-b5e6-96231b3b80d8
asic/basic.lookup/basic.lookup.qual/namespace.qual/p2.cpp
lass.access/class.friend/p1.cpp
lass/class.friend/p1.cpp
lass/class.local/p2.cpp
lass/class.union/p1.cpp
onv/conv.mem/p4.cpp
cl.dcl/dcl.spec/dcl.stc/p9.cpp
cl.dcl/dcl.spec/dcl.type/dcl.type.elab/p3.cpp
cl.decl/dcl.init/dcl.init.ref/p5-examples.cpp
cl.decl/dcl.init/dcl.init.ref/p5-var.cpp
cl.decl/dcl.init/p6.cpp
cl.decl/dcl.meaning/dcl.mptr/p3.cpp
3cb0ebd5f76abcb776f7cb4062bd79e3268c0dc4 10-Mar-2010 John McCall <rjmccall@apple.com> Create a new InjectedClassNameType to represent bare-word references to the
injected class name of a class template or class template partial specialization.
This is a non-canonical type; the canonical type is still a template
specialization type. This becomes the TypeForDecl of the pattern declaration,
which cleans up some amount of code (and complicates some other parts, but
whatever).

Fixes PR6326 and probably a few others, primarily by re-establishing a few
invariants about TypeLoc sizes.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98134 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/dcl.spec/dcl.type/dcl.type.elab/p3.cpp
516a6bc399f1f4595423e80c9d4bc687f870acd1 08-Mar-2010 Douglas Gregor <dgregor@apple.com> In C++98/03, an uninitialized variable that has POD class type will be
uninitialized. This seems not to be the case in C++0x, where we still
call the (trivial) default constructor for a POD class
(!). Previously, we had implemented only the C++0x rules; now we
implement both. Fixes PR6536.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97928 91177308-0d34-0410-b5e6-96231b3b80d8
cl.decl/dcl.init/p6.cpp
6d1828949df82e2f2bb2606ea7a3b40029a7f9e2 06-Mar-2010 Douglas Gregor <dgregor@apple.com> When declaring a catch block in C++, make sure that the type being
caught can be copy-initialized and destructed. Fixes PR6518.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97853 91177308-0d34-0410-b5e6-96231b3b80d8
xcept/except.handle/p16.cpp
5fccd36204f11c8491325038e6ffcc784399098e 04-Mar-2010 Douglas Gregor <dgregor@apple.com> Reinstate r97674 with a fix for the assertion that was firing in <list>


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97686 91177308-0d34-0410-b5e6-96231b3b80d8
lass.derived/class.member.lookup/p8.cpp
a7cb22d27f4440d264f2a1407c43b8d7259d23b0 04-Mar-2010 Douglas Gregor <dgregor@apple.com> Revert r97674; it's causing failures

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97677 91177308-0d34-0410-b5e6-96231b3b80d8
lass.derived/class.member.lookup/p8.cpp
b29b37d7e5bba50acc3a6642a2c90db080c22b90 03-Mar-2010 Douglas Gregor <dgregor@apple.com> Implement disambiguation of base class members via a
nested-name-specifier. For example, this allows member access in
diamond-shaped hierarchies like:

struct Base {
void Foo();
int Member;
};

struct D1 : public Base {};
struct D2 : public Base {};

struct Derived : public D1, public D2 { }

void Test(Derived d) {
d.Member = 17; // error: ambiguous cast from Derived to Base
d.D1::Member = 17; // error: okay, modify D1's Base's Member
}

Fixes PR5820 and <rdar://problem/7535045>. Also, eliminate some
redundancy between Sema::PerformObjectMemberConversion() and
Sema::PerformObjectArgumentInitialization() -- the latter now calls
the former.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97674 91177308-0d34-0410-b5e6-96231b3b80d8
lass.derived/class.member.lookup/p8.cpp
4e6ba4be8ddeca2978da6b9bae02cbe9594f2ef4 03-Mar-2010 Douglas Gregor <dgregor@apple.com> Implement name hiding for names found through virtual base subobjects
that are hidden by other derived base subobjects reached along a
lookup path that does *not* pass through the hiding subobject (C++
[class.member.lookup]p6). Fixes PR6462.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97640 91177308-0d34-0410-b5e6-96231b3b80d8
lass.derived/class.member.lookup/p6.cpp
e97c32f9578861d575ca96bbbae426c76cbc9024 03-Mar-2010 John McCall <rjmccall@apple.com> Suppress implicit member redeclarations arising from explicit instantiation
declarations after the member has been explicitly specialized. We already
did this after explicit instantiation definitions; not doing it for
declarations meant that subsequent definitions would see a previous
member declaration with specialization kind "explicit instantiation decl",
which would then happily get overridden.

Fixes PR 6458.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97605 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.spec/temp.explicit/p4.cpp
21d53e179651657e243587b79234fe6fedfae71c 02-Mar-2010 Douglas Gregor <dgregor@apple.com> When we're parsing template names as part of base-specifiers, we are
*not* entering the context of the nested-name-specifier. This was
causing us to look into an uninstantiated template that we shouldn't
look into. Fixes PR6376.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97524 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.mem/p1.cpp
7bf3600f56342dc434dad994d0c71068e5d3b5c7 01-Mar-2010 Chandler Carruth <chandlerc@gmail.com> Fix the lookup of names used in a friend declaration to not attempt to
re-declare them. This fixes PR6317. Also add the beginnings of an interesting
test case for p1 of [class.friend] which also covers PR6317.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97499 91177308-0d34-0410-b5e6-96231b3b80d8
lass.access/class.friend/p1.cpp
a9bff30776888977f580c9cac212fd1583ee963e 28-Feb-2010 Douglas Gregor <dgregor@apple.com> Warn about the deprecated string literal -> char* conversion. Fixes PR6428.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97404 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.fct.spec/temp.arg.explicit/p3.cpp
9ba6166f4a78722e7df8ffbd64eb788bfdf2764a 26-Feb-2010 John McCall <rjmccall@apple.com> Fix an assertion-on-error during tentative constructor parsing by
propagating error conditions out of the various annotate-me-a-snowflake
routines. Generally (but not universally) removes redundant diagnostics
as well as, you know, not crashing on bad code. On the other hand,
I have just signed myself up to fix fiddly parser errors for the next
week. Again.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97221 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.fct.spec/temp.arg.explicit/p3-nodeduct.cpp
dc0a11cf52cf34ffae941255df60a086e44d1a71 26-Feb-2010 Douglas Gregor <dgregor@apple.com> An explicit specialization is allowed following an explicit
instantiation so long as that explicit specialization was declared
previously. Fixes PR6160.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97210 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.spec/temp.expl.spec/p6.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/expr.unary/expr.new/p19.cpp
xpr/expr.unary/expr.new/p20-0x.cpp
xpr/expr.unary/expr.new/p20.cpp
692f85c1d217c8c3cdc06d884ad61b101c75c856 26-Feb-2010 Douglas Gregor <dgregor@apple.com> Commit Eli's fix for implicit conversions to array type. Fixes PR6264.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97202 91177308-0d34-0410-b5e6-96231b3b80d8
cl.decl/dcl.init/dcl.init.ref/p5.cpp
78bd771b27d696d156899471303622fa51f52438 25-Feb-2010 Chandler Carruth <chandlerc@gmail.com> Fix a really trivial crasher and begin fleshing out one of the namespace test
cases.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97134 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/basic.namespace/namespace.def/namespace.memdef/p3.cpp
eba9acec3780d49acfd32447b1f20d7c366b0959 24-Feb-2010 Douglas Gregor <dgregor@apple.com> Add test case for PR6141, which was fixed a few days ago

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97063 91177308-0d34-0410-b5e6-96231b3b80d8
pecial/class.copy/p3.cpp
93649fdc5e0c46e26bcba06ad39aa80196d3df27 23-Feb-2010 Douglas Gregor <dgregor@apple.com> Implement crazy destructor name lookup semantics differently in
C++98/03 and C++0x, since the '0x semantics break valid C++98/03
code. This new mess is tracked by core issue 399, which is still
unresolved.

Fixes PR6358 and PR6359.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96836 91177308-0d34-0410-b5e6-96231b3b80d8
asic/basic.lookup/basic.lookup.classref/p3.cpp
asic/basic.lookup/basic.lookup.qual/p6-0x.cpp
asic/basic.lookup/basic.lookup.qual/p6.cpp
bf1764cf59e3158ad47dc1720a74490750923575 22-Feb-2010 Douglas Gregor <dgregor@apple.com> Do not require a complete type when checking for a pointer conversion
between cv1 T* and cv2 T*.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96787 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.spec/temp.explicit/p6.cpp
8761d680eaa7386e03f51286f4b84a1ffe575e2e 21-Feb-2010 Chandler Carruth <chandlerc@gmail.com> Make Decl::isOutOfLine() virtual, and use that to determine when definitions
are for out of line declarations more easily. This simplifies the logic and
handles the case of out-of-line class definitions correctly. Fixes PR6107.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96729 91177308-0d34-0410-b5e6-96231b3b80d8
lass/class.nest/p3.cpp
fe3310697028d8d3d35a11b0877bb2bc47e55b8d 13-Feb-2010 Douglas Gregor <dgregor@apple.com> Permit the use of typedefs of class template specializations in
qualified declarator-ids. This patch is actually due to Cornelius;
fixes PR6179.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96082 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.spec/temp.expl.spec/p17.cpp
6b2accb4793e16b2e93a8c2589f5df702231f17a 10-Feb-2010 John McCall <rjmccall@apple.com> Improve access control diagnostics. Perform access control on member-pointer
conversions. Fix an access-control bug where privileges were not considered
at intermediate points along the inheritance path. Prepare for friends.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95775 91177308-0d34-0410-b5e6-96231b3b80d8
lass.access/class.access.base/p1.cpp
lass.access/p4.cpp
lass.access/p6.cpp
lass/class.local/p2.cpp
onv/conv.mem/p4.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
cl.decl/dcl.init/p6.cpp
xpr/p8.cpp
emp/temp.decls/temp.mem/p5.cpp
ed814cc4cd2bd4d32cbb4bfde3cc59ccae723a92 09-Feb-2010 John McCall <rjmccall@apple.com> Reset the found-virtual-base state unless the *current* base produces a path,
not *any* base up to now has produced a path. Fixes PR 6254.

I'll do the access-control part of this patch RSN.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95638 91177308-0d34-0410-b5e6-96231b3b80d8
onv/conv.mem/p4.cpp
dcee98048d5147502da2b224f01d08f24aec2293 09-Feb-2010 Douglas Gregor <dgregor@apple.com> When substituting a declaration non-type template argument for a
non-type template parameter that has reference type, augment the
qualifiers of the non-type template argument with those of the
referenced type. Fixes PR6250.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95607 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.arg/temp.arg.nontype/p5.cpp
35911ce76bed5fa64dcc368cbd81f6ec7b71aa75 08-Feb-2010 Sebastian Redl <sebastian.redl@getdesigned.at> Add a test case for r95555.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95562 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.names/p4.cpp
a9a55c063e9e59c6ab0a6d7a21302660f7bde9f9 06-Feb-2010 Douglas Gregor <dgregor@apple.com> Switch CodeGen's "is this variable declaration a definition?" logic
over to VarDecl::isThisDeclarationADefinition(), which handles
variables declared with linkage specifications better (among other
things). CMake 2.9 (from CVS) now builds with clang++ and is somewhat
functional.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95486 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/dcl.link/p7.cpp
e41ac7b007d64b504f8e79b97839d060a3669171 05-Feb-2010 Douglas Gregor <dgregor@apple.com> Fix a bogus assertion after adjusting the type of a substituted
non-type template argument for a non-type template parameter of
pointer type. Fixes PR6244.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95447 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.arg/temp.arg.nontype/p5.cpp
86a7625062abbd40fffa186f2f5d305cc89615b8 04-Feb-2010 Douglas Gregor <dgregor@apple.com> When substituting the template argument for a pointer non-type
template parameter, perform array/function decay (if needed), take the
address of the argument (if needed), perform qualification conversions
(if needed), and remove any top-level cv-qualifiers from the resulting
expression. Fixes PR6226.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95309 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.arg/temp.arg.nontype/p5.cpp
d9bafa76f8d6eb9e4f4974ed322217f8df6bb82e 03-Feb-2010 Sebastian Redl <sebastian.redl@getdesigned.at> In some contexts, type declarations cannot occur. Pass this information down to ParseClassSpecifier, to make its decision easier. Fixes PR6200.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95255 91177308-0d34-0410-b5e6-96231b3b80d8
cl.decl/dcl.name/p1.cpp
22c92406f4b043bd872b53761f6a157fcc105594 03-Feb-2010 Sebastian Redl <sebastian.redl@getdesigned.at> Top-level const changes do not make a qualification conversion. Fixes PR6089.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95239 91177308-0d34-0410-b5e6-96231b3b80d8
onv/conv.qual/pr6089.cpp
136b0cd75c37895ed0e00dee5b06c55c5b1d8199 03-Feb-2010 Eli Friedman <eli.friedman@gmail.com> Fix for PR6220: compute the correct type for multicharacter literals.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95228 91177308-0d34-0410-b5e6-96231b3b80d8
ex/lex.literal/lex.ccon/p1.cpp
5147fa6d580e4c123d0a90fa737f40824f50aa50 03-Feb-2010 Chandler Carruth <chandlerc@gmail.com> Fix PR6149 by looking at the qualifiers on the referred to type for non-type
reference template arguments. Adds test cases for the cv-quals of reference
arguments.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95217 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.arg/temp.arg.nontype/p5.cpp
4cae1b343c7c588856df17d6a11af1614ac41308 02-Feb-2010 Sebastian Redl <sebastian.redl@getdesigned.at> Check for redefinitions in MergeVarDecl. This finds redefinitions of globals without an initializer in C++ and thus fixes PR5451.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95098 91177308-0d34-0410-b5e6-96231b3b80d8
asic/basic.def.odr/p1-var.cpp
4f9506a27cb6b865bf38beea48eadfa9dc93f510 02-Feb-2010 John McCall <rjmccall@apple.com> Access control for implicit destructor calls. Diagnostic could be orders of
magnitude clearer.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95078 91177308-0d34-0410-b5e6-96231b3b80d8
lass.access/p4.cpp
0519fe2e11ae60d297b50f5497761045783f79c7 02-Feb-2010 John McCall <rjmccall@apple.com> FIXME complete.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95059 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.fct.spec/temp.deduct/temp.deduct.call/p6.cpp
5920dbba965a2f2a963313d94be3ff3d2b67ece7 02-Feb-2010 John McCall <rjmccall@apple.com> Improve the diagnostic used when an incompatible overload set is passed
as an argument during overload resolution.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95057 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.fct.spec/temp.deduct/temp.deduct.call/p6.cpp
eff92135d32039c9874dc356f3e93143af6069c1 02-Feb-2010 John McCall <rjmccall@apple.com> Implement C++ [temp.deduct.call]p6, template argument deduction for overloaded
arguments. Fix a bug where incomplete explicit specializations were being
passed through as legitimate. Fix a bug where the absence of an explicit
specialization in an overload set was causing overall deduction to fail.

Fixes PR6191.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95052 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.fct.spec/temp.deduct/temp.deduct.call/p6.cpp
677e4feebe4b3485504860d991d700cc3b933961 02-Feb-2010 Douglas Gregor <dgregor@apple.com> Improve handling of enumerator values for C and C++, including:

- In C++, prior to the closing '}', set the type of enumerators
based on the type of their initializer. Don't perform unary
conversions on the enumerator values.
- In C++, handle overflow when an enumerator has no initializer and
its value cannot be represented in the type of the previous
enumerator.
- In C, handle overflow more gracefully, by complaining and then
falling back to the C++ rules.
- In C, if the enumerator value is representable in an int, convert the
expression to the type 'int'.

Fixes PR5854 and PR4515.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95031 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/dcl.enum/p5.cpp
342fec43c515184a3c0d0600323dfec2b059e74e 01-Feb-2010 John McCall <rjmccall@apple.com> Note that an overload candidate was non-viable because template argument
deduction failed. Right now there's a very vague diagnostic for most cases
and a good diagnostic for incomplete deduction.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94988 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.fct.spec/temp.arg.explicit/p3.cpp
emp/temp.fct.spec/temp.deduct/temp.deduct.call/basic.cpp
b13b737a2450167c82e148590e8019b839ce6b98 01-Feb-2010 John McCall <rjmccall@apple.com> Access checking for implicit user-defined conversions.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94971 91177308-0d34-0410-b5e6-96231b3b80d8
lass.access/p6.cpp
038cc399940deefc0f55aad8be97312a7390e2ad 31-Jan-2010 Chandler Carruth <chandlerc@gmail.com> Fix PR6159 and several other problems with value-dependent non-type template
arguments. This both prevents meaningless checks on these arguments and ensures
that they are represented as an expression by the instantiation.

Cleaned up and added standard text to the relevant test case. Also started
adding tests for *rejected* cases. At least one FIXME here where (I think) we
allow something we shouldn't. More to come in the area of rejecting crazy
arguments with decent diagnostics. Suggestions welcome for still better
diagnostics on these errors!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94953 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.arg/temp.arg.nontype/p1.cpp
9db7dbb918ca49f4ee6c181e4917e7b6ec547353 31-Jan-2010 Douglas Gregor <dgregor@apple.com> Rework base and member initialization in constructors, with several
(necessarily simultaneous) changes:

- CXXBaseOrMemberInitializer now contains only a single initializer
rather than a set of initialiation arguments + a constructor. The
single initializer covers all aspects of initialization, including
constructor calls as necessary but also cleanup of temporaries
created by the initializer (which we never handled
before!).

- Rework + simplify code generation for CXXBaseOrMemberInitializers,
since we can now just emit the initializer as an initializer.

- Switched base and member initialization over to the new
initialization code (InitializationSequence), so that it

- Improved diagnostics for the new initialization code when
initializing bases and members, to match the diagnostics produced
by the previous (special-purpose) code.

- Simplify the representation of type-checked constructor initializers in
templates; instead of keeping the fully-type-checked AST, which is
rather hard to undo at template instantiation time, throw away the
type-checked AST and store the raw expressions in the AST. This
simplifies instantiation, but loses a little but of information in
the AST.

- When type-checking implicit base or member initializers within a
dependent context, don't add the generated initializers into the
AST, because they'll look like they were explicit.

- Record in CXXConstructExpr when the constructor call is to
initialize a base class, so that CodeGen does not have to infer it
from context. This ensures that we call the right kind of
constructor.

There are also a few "opportunity" fixes here that were needed to not
regress, for example:

- Diagnose default-initialization of a const-qualified class that
does not have a user-declared default constructor. We had this
diagnostic specifically for bases and members, but missed it for
variables. That's fixed now.

- When defining the implicit constructors, destructor, and
copy-assignment operator, set the CurContext to that constructor
when we're defining the body.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94952 91177308-0d34-0410-b5e6-96231b3b80d8
cl.decl/dcl.init/p6.cpp
b7de181d912690958e82c01f1b3d752d3d4ab43b 31-Jan-2010 Chandler Carruth <chandlerc@gmail.com> Fix PR6156 and test several of the basic aspects of non-type template arguments
when implicitly supplied to the injected class name.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94948 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.res/temp.local/p1.cpp
548028b3ca15926c6883357e111b47bbc56a4761 31-Jan-2010 Chandler Carruth <chandlerc@gmail.com> Handle instantiation of templates with non-type arguments expressed with an
explicit '&' by introducing an address-of operator prior to checking the
argument's type.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94947 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.arg/temp.arg.nontype/p1.cpp
e14654b3b749421e21a4d917cdbcaf5589c0c6c3 29-Jan-2010 Douglas Gregor <dgregor@apple.com> PR5909 had a test case for binding of const, non-volatile references
to bitfields. Add it here.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94832 91177308-0d34-0410-b5e6-96231b3b80d8
cl.decl/dcl.init/dcl.init.ref/p5.cpp
ef06e2451c3069569ba543e7b1c5e0de7a257005 29-Jan-2010 Douglas Gregor <dgregor@apple.com> Fix reference-binding when we have a reference to const volatile type;
previously, we were allowing this to bind to a temporary. Now, we
don't; add test-cases and improve diagnostics.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94831 91177308-0d34-0410-b5e6-96231b3b80d8
cl.decl/dcl.init/dcl.init.ref/p5-var.cpp
233a6419097ed97b67ff8efcacef9af613262ca3 28-Jan-2010 John McCall <rjmccall@apple.com> Access control for surrogate function calls. Required a moderately gross hack
to get the access bits set properly in conversion sets.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94744 91177308-0d34-0410-b5e6-96231b3b80d8
lass.access/p4.cpp
41d8903731782ee85ee2b19734008b006e01c76f 28-Jan-2010 John McCall <rjmccall@apple.com> Access control for overloaded call operators. Not for surrogates yet,
mostly because we're going to want a better diagnostic for conversions.

Also this API needs to go back to sanity.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94730 91177308-0d34-0410-b5e6-96231b3b80d8
lass.access/p4.cpp
5357b615364c17ea024c757354c58ae2a520d216 28-Jan-2010 John McCall <rjmccall@apple.com> Access checking for overloaded operators.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94725 91177308-0d34-0410-b5e6-96231b3b80d8
lass.access/p4.cpp
2f514480c448708ec382a684cf5e035d3a827ec8 27-Jan-2010 John McCall <rjmccall@apple.com> Implement access-check delays for out-of-line member definitions
using the same framework we use for deprecation warnings.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94659 91177308-0d34-0410-b5e6-96231b3b80d8
lass.access/p6.cpp
c373d48502ca7683ab55385f5bd624d778eb288d 27-Jan-2010 John McCall <rjmccall@apple.com> Implement access control for overloaded functions. Suppress access control
diagnostics in "early" lookups, such as during typename checks and when building
unresolved lookup expressions.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94647 91177308-0d34-0410-b5e6-96231b3b80d8
lass.access/p4.cpp
78a527af9995e936c0fc7dc01a061810cabf4c31 26-Jan-2010 Sebastian Redl <sebastian.redl@getdesigned.at> Fix two redefinitions in test cases that weren't diagnosed yet, but will be soon.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94565 91177308-0d34-0410-b5e6-96231b3b80d8
asic/basic.lookup/basic.lookup.elab/templateid.cpp
0757c8ccb79210ce1f22142851cdcbf6e42a71d6 24-Jan-2010 Anders Carlsson <andersca@mac.com> Implement [dcl.fct.spec]p6.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94365 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/dcl.spec/dcl.fct.spec/p6.cpp
92f883177b162928a8e632e4e3b93fafd2b26072 23-Jan-2010 John McCall <rjmccall@apple.com> Implement elementary access control.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94268 91177308-0d34-0410-b5e6-96231b3b80d8
lass.access/class.access.base/p1.cpp
0efc2c1716be4f1c5f1343cad3b047e74861f030 13-Jan-2010 Douglas Gregor <dgregor@apple.com> Reimplement constructor declarator parsing to cope with template-ids
that name constructors, the endless joys of out-of-line constructor
definitions, and various other corner cases that the previous hack
never imagined. Fixes PR5688 and tightens up semantic analysis for
constructor names.

Additionally, fixed a problem where we wouldn't properly enter the
declarator scope of a parenthesized declarator. We were entering the
scope, then leaving it when we saw the ")"; now, we re-enter the
declarator scope before parsing the parameter list.

Note that we are forced to perform some tentative parsing within a
class (call it C) to tell the difference between

C(int); // constructor

and

C (f)(int); // member function

which is rather unfortunate. And, although it isn't necessary for
correctness, we use the same tentative-parsing mechanism for
out-of-line constructors to improve diagnostics in icky cases like:

C::C C::f(int); // error: C::C refers to the constructor name, but
// we complain nicely and recover by treating it as
// a type.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93322 91177308-0d34-0410-b5e6-96231b3b80d8
asic/basic.lookup/basic.lookup.qual/class.qual/p2.cpp
pecial/class.ctor/p1.cpp
220ccbf2c9ef97034cce80561f9f46c4f1f63bc7 13-Jan-2010 John McCall <rjmccall@apple.com> Improve the reporting of non-viable overload candidates by noting the reason
why the candidate is non-viable. There's a lot we can do to improve this, but
it's a good start. Further improvements should probably be integrated with the
bad-initialization reporting routines.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93277 91177308-0d34-0410-b5e6-96231b3b80d8
cl.decl/dcl.init/dcl.init.ref/p5-var.cpp
emp/temp.decls/temp.class/temp.static/p1-inst.cpp
emp/temp.decls/temp.class/temp.static/p1.cpp
emp/temp.param/p3.cpp
emp/temp.spec/temp.expl.spec/p4.cpp
emp/temp.spec/temp.explicit/p1.cpp
05f650001bc66c2dc238e7cee709cb7896bd8a37 11-Jan-2010 Douglas Gregor <dgregor@apple.com> C++0x [dcl.typedef]p4, take 3, where we actually figure out what "that
is not also a typedef-name" actually means. For anyone keeping score,
that's John: 2, Doug: 0.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93196 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/dcl.spec/dcl.typedef/p4.cpp
39700992bf99573983ff80fc519ec51fce0f0f61 11-Jan-2010 Douglas Gregor <dgregor@apple.com> Use isa<ElaboratedType> rather than getAs<ElaboratedType>, since the
latter may (eventually) perform multiple levels of desugaring (thus
breaking the newly-added tests) and the former is faster. Thanks, John!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93192 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/dcl.spec/dcl.typedef/p4.cpp
93dda720a6f5b67ea997c8d98414f90ec362b43c 11-Jan-2010 Douglas Gregor <dgregor@apple.com> Allow redefinitions of typedef-names within class scope when the type
they redefine is a class-name but not a typedef-name, per C++0x
[dcl.typedef]p4. The code in the test was valid C++98 and is valid
C++0x, but an unintended consequence of DR56 made it ill-formed in
C++03 (which we were luck enough to implement). Fixes PR5455.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93188 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/dcl.spec/dcl.typedef/p4.cpp
9e68871f1e99e7e1536f16d5364fd5e2a352e9c4 11-Jan-2010 Douglas Gregor <dgregor@apple.com> When resolving a single function template specialization to a
function, be sure to adjust the resulting argument type to a pointer
(if necessary). Fixes PR5910 and PR5949.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93178 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.fct.spec/temp.arg.explicit/p3.cpp
9791bdc9b67435376f0b65686b627f5b3c6d1869 11-Jan-2010 Douglas Gregor <dgregor@apple.com> Test case for naming of conversion function template specializations

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93177 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.mem/p5.cpp
b67270724f3924ab7ffbc05ebbe06f83c3fed7e4 07-Jan-2010 John McCall <rjmccall@apple.com> When parsing an identifier as an expression in C++, only try to annotate it
as a type or scope token if the next token requires it.

This eliminates a lot of redundant lookups in C++, but there's room for
improvement; a better solution would do a single lookup whose kind and
results would be passed through the parser.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92930 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/basic.namespace/namespace.udecl/p4.cpp
21714013498fd84a6e8d5ceb1af5d14b6531cfb5 06-Jan-2010 Douglas Gregor <dgregor@apple.com> Add test from PR5913, which has already been fixed

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92863 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.fct.spec/temp.deduct/temp.deduct.call/p3.cpp
b1622a1fd7b7f4ab8d00d0183d17c90ad25c14e3 06-Jan-2010 John McCall <rjmccall@apple.com> Improve the diagnostics used to report implicitly-generated class members
as parts of overload sets. Also, refer to constructors as 'constructors'
rather than functions.

Adjust a lot of tests.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92832 91177308-0d34-0410-b5e6-96231b3b80d8
cl.decl/dcl.init/dcl.init.ref/p5-var.cpp
emp/temp.decls/temp.class/temp.static/p1-inst.cpp
emp/temp.decls/temp.class/temp.static/p1.cpp
emp/temp.param/p3.cpp
emp/temp.spec/temp.expl.spec/p15.cpp
emp/temp.spec/temp.expl.spec/p4.cpp
emp/temp.spec/temp.explicit/p1.cpp
442471309fa97348f849687a6a8ef4acc3bc2c1f 04-Jan-2010 Douglas Gregor <dgregor@apple.com> Make sure to use ASTContext::getAs*ArrayType() when decomposing array
types. Fixes APFloat.cpp compilation failure.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92523 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.fct.spec/temp.deduct/temp.deduct.call/p3.cpp
6675586c70945fdd71911d96f83324788b93edd4 24-Dec-2009 John McCall <rjmccall@apple.com> Tweak the text of several main() diagnostics and punch a hole specifically for
Darwin's sekrit fourth argument. This should probably be factored to
let targets make target-specific decisions about what main() should look like.

Fixes rdar://problem/7414990
or if different platforms have radically different ideas of what they want in



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92128 91177308-0d34-0410-b5e6-96231b3b80d8
asic/basic.start/basic.start.main/p2f.cpp
90f9382b3e97afa55e6aaaa4ab31c7473a8c7bb9 22-Dec-2009 Douglas Gregor <dgregor@apple.com> Switch Sema::AddCXXDirectInitializerToDecl over to InitializationSequence

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91927 91177308-0d34-0410-b5e6-96231b3b80d8
asic/basic.lookup/basic.lookup.unqual/p14.cpp
b4debaebedfeb3161cd7bce0d13f005ab442fa5e 22-Dec-2009 Douglas Gregor <dgregor@apple.com> Enter the scope of an initializer for direct-initialization as well as
for copy-initialization.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91909 91177308-0d34-0410-b5e6-96231b3b80d8
asic/basic.lookup/basic.lookup.unqual/p14.cpp
4a2c19bf2330e31851330423187ec48035cab1a5 22-Dec-2009 Eli Friedman <eli.friedman@gmail.com> Switch default arguments over to InitializationSequence.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91883 91177308-0d34-0410-b5e6-96231b3b80d8
cl.decl/dcl.meaning/dcl.fct.default/p5.cpp
a91eb541a6adf81acf872e7315bc6b814c3241eb 22-Dec-2009 Eli Friedman <eli.friedman@gmail.com> Switch file-scope assignment initialization over to InitializationSequence.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91881 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.spec/temp.explicit/p1.cpp
emp/temp.spec/temp.explicit/p10.cpp
4b52e25f3b05ab0f9d2492276a52323a50a84fb7 22-Dec-2009 Douglas Gregor <dgregor@apple.com> When a template-id refers to a single function template, and the
explicitly-specified template arguments are enough to determine the
instantiation, and either template argument deduction fails or is not
performed in that context, we can resolve the template-id down to a
function template specialization (so sayeth C++0x
[temp.arg.explicit]p3). Fixes PR5811.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91852 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.fct.spec/temp.arg.explicit/p3-nodeduct.cpp
0f0615bba035f5aeaed0960d5a7802dff42f4b60 21-Dec-2009 Eli Friedman <eli.friedman@gmail.com> Fix for PR5840: fix the kind of name lookup used for classes in
Sema::getTypeName.

"LookupNestedNameSpecifierName" isn't quite the right kind of lookup, though;
it doesn't ignore namespaces. Someone more familiar with the lookup code
should fix this properly.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91809 91177308-0d34-0410-b5e6-96231b3b80d8
lass.derived/p2.cpp
745880f35066bdb1950d0e870608295221346fc5 20-Dec-2009 Douglas Gregor <dgregor@apple.com> Switch default-initialization of variables of class type (or array thereof) over to InitializationSequence. I could swear that this fixes a PR somewhere, but I couldn't figure out which one

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91796 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.spec/temp.expl.spec/p15.cpp
emp/temp.spec/temp.expl.spec/p4.cpp
emp/temp.spec/temp.explicit/p1.cpp
f9368159334ff86ea5fa367225c1a580977f3b03 20-Dec-2009 John McCall <rjmccall@apple.com> Don't inject the class name until that magical lbrace.

Because of the rules of base-class lookup* and the restrictions on typedefs, it
was actually impossible for this to cause any problems more serious than the
spurious acceptance of
template <class T> class A : B<A> { ... };
instead of
template <class T> class A : B<A<T> > { ... };
but I'm sure we can all agree that that is a very important restriction which
is well worth making another Parser->Sema call for.

(*) n.b. clang++ does not implement these rules correctly; we are not ignoring
non-type names



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91792 91177308-0d34-0410-b5e6-96231b3b80d8
asic/basic.lookup/basic.lookup.unqual/p7.cpp
84d11c7ba48023b2bd3375ef002e08fecdb186ce 20-Dec-2009 John McCall <rjmccall@apple.com> Test the lookup I wasn't sure would be done properly after the last patch.
Clang reasonably adds all the base specifiers in one pass; this is now required
for correctness to prevent lookup from going mad. But this has the advantage of
establishing the correct context when looking up base specifiers, which will be
important for access control.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91791 91177308-0d34-0410-b5e6-96231b3b80d8
asic/basic.lookup/basic.lookup.unqual/p7.cpp
bd0dfa5c37d422427080a0ae3af9b63e70e6e854 19-Dec-2009 John McCall <rjmccall@apple.com> Parse base specifiers within the scope of the class. This is possibly not
quite right; I'll come back to it later. It does fix PR 5741.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91789 91177308-0d34-0410-b5e6-96231b3b80d8
asic/basic.lookup/basic.lookup.unqual/p7.cpp
7a1dc562d4ad59237ed9fe7e8cef56f9eaa7a26c 19-Dec-2009 John McCall <rjmccall@apple.com> Refactor to remove more dependencies on PreDeclaratorDC. I seem to have made
the redeclaration problems in the [temp.explicit]p3 testcase worse, but I can
live with that; they'll need to be fixed more holistically anyhow.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91771 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.spec/temp.explicit/p3.cpp
731ad843b7bf1862f6547ac79539f0f5b4c539bd 19-Dec-2009 John McCall <rjmccall@apple.com> Just push a new scope when parsing an out-of-line variable definition.
Magically fixes all the terrible lookup problems associated with not pushing
a new scope. Resolves an ancient xfail and an LLVM misparse.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91769 91177308-0d34-0410-b5e6-96231b3b80d8
asic/basic.lookup/basic.lookup.unqual/p14.cpp
cfdc81a83467973b14e4ea5e9e9af1690f135415 19-Dec-2009 Eli Friedman <eli.friedman@gmail.com> Initialization improvements: addition of string initialization and a few
small bug fixes in SemaInit, switch over SemaDecl to use it more often, and
change a bunch of diagnostics which are different with the new initialization
code.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91767 91177308-0d34-0410-b5e6-96231b3b80d8
lass/class.local/p2.cpp
cl.decl/dcl.meaning/dcl.mptr/p3.cpp
ver/over.over/p2.cpp
ver/over.over/p4.cpp
2d48e7811216b2a2d15dcf7e4be8f73ad48cc60a 19-Dec-2009 Douglas Gregor <dgregor@apple.com> A CXXExprWithTemporaries expression is an lvalue if its subexpression
is an lvalue. Fixes PR5787.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91765 91177308-0d34-0410-b5e6-96231b3b80d8
cl.decl/dcl.init/dcl.init.ref/basic.cpp
7abfbdbc97ad8e7f340789f751df1e32b10118b4 19-Dec-2009 Douglas Gregor <dgregor@apple.com> Switch more of Sema::CheckInitializerTypes over to
InitializationSequence. Specially, switch initialization of a C++
class type (either copy- or direct-initialization).

Also, make sure that we create an elidable copy-construction when
performing copy initialization of a C++ class variable. Fixes PR5826.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91750 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.class/temp.static/p1-inst.cpp
emp/temp.decls/temp.class/temp.static/p1.cpp
emp/temp.param/p3.cpp
18ef5e28a9a2677f8b1dce1fb2638d66e0a1621f 18-Dec-2009 Douglas Gregor <dgregor@apple.com> Switch the initialization required by return statements over to the
new InitializationSequence. This fixes some bugs (e.g., PR5808),
changed some diagnostics, and caused more churn than expected. What's
new:

- InitializationSequence now has a "C conversion sequence" category
and step kind, which falls back to
- Changed the diagnostics for returns to always have the result type
of the function first and the type of the expression second.
CheckSingleAssignmentConstraints to peform checking in C.
- Improved ASTs for initialization of return values. The ASTs now
capture all of the temporaries we need to create, but
intentionally do not bind the tempoary that is actually returned,
so that it won't get destroyed twice.
- Make sure to perform an (elidable!) copy of the class object that
is returned from a class.
- Fix copy elision in CodeGen to properly see through the
subexpressions that occur with elidable copies.
- Give "new" its own entity kind; as with return values and thrown
objects, we don't bind the expression so we don't call a
destructor for it.

Note that, with this patch, I've broken returning move-only types in
C++0x. We'll fix it later, when we tackle NRVO.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91669 91177308-0d34-0410-b5e6-96231b3b80d8
cl.decl/dcl.init/dcl.init.ref/p5-var.cpp
emp/temp.decls/temp.class/temp.static/p1.cpp
578b69b186d9cba0a6ae1dd7f4c04cd6a49f0aac 16-Dec-2009 John McCall <rjmccall@apple.com> Introduce a centralized routine in Sema for diagnosing failed lookups (when
used as expressions). In dependent contexts, try to recover by doing a lookup
in previously-dependent base classes. We get better diagnostics out, but
unfortunately the recovery fails: we need to turn it into a method call
expression, not a bare call expression. Thus this is still a WIP.




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91525 91177308-0d34-0410-b5e6-96231b3b80d8
asic/basic.lookup/basic.lookup.argdep/p4.cpp
emp/temp.fct.spec/temp.arg.explicit/p3.cpp
emp/temp.fct.spec/temp.deduct/temp.deduct.call/basic.cpp
5fdd7643ae81af4ace04f8be888f225b9fcc64b7 16-Dec-2009 John McCall <rjmccall@apple.com> Successive anonymous namespaces name the same scope. I misinterpreted the
standard the last time. Fixes PR5766.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91493 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/basic.namespace/namespace.def/namespace.unnamed/p1.cpp
80737ad5e0a67d6e3dd0a0ba48446344215a5fd5 15-Dec-2009 Daniel Dunbar <daniel@zuster.org> Update tests to use %clang instead of 'clang', and forcibly disable use of '
clang ' or ' clang -cc1 ' or ' clang-cc ' in test lines (by substituting them to
garbage).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91460 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/basic.namespace/namespace.udecl/p10.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
asic/basic.def.odr/p2-typeid.cpp
asic/basic.link/p9.cpp
asic/basic.lookup/basic.lookup.argdep/p2-template-id.cpp
asic/basic.lookup/basic.lookup.argdep/p2.cpp
asic/basic.lookup/basic.lookup.argdep/p3.cpp
asic/basic.lookup/basic.lookup.argdep/p4.cpp
asic/basic.lookup/basic.lookup.elab/templateid.cpp
asic/basic.lookup/basic.lookup.qual/namespace.qual/p2.cpp
asic/basic.lookup/basic.lookup.qual/namespace.qual/p3.cpp
asic/basic.lookup/basic.lookup.qual/namespace.qual/p4.cpp
asic/basic.lookup/basic.lookup.qual/namespace.qual/p5.cpp
asic/basic.lookup/basic.lookup.udir/p1.cpp
asic/basic.lookup/basic.lookup.unqual/p11.cpp
asic/basic.lookup/basic.lookup.unqual/p12.cpp
asic/basic.lookup/basic.lookup.unqual/p13.cpp
asic/basic.lookup/basic.lookup.unqual/p14.cpp
asic/basic.lookup/basic.lookup.unqual/p15.cpp
asic/basic.lookup/basic.lookup.unqual/p3.cpp
asic/basic.start/basic.start.main/p2a.cpp
asic/basic.start/basic.start.main/p2b.cpp
asic/basic.start/basic.start.main/p2c.cpp
asic/basic.start/basic.start.main/p2d.cpp
asic/basic.start/basic.start.main/p2e.cpp
asic/basic.start/basic.start.main/p2f.cpp
asic/basic.start/basic.start.main/p2g.cpp
asic/basic.stc/basic.stc.dynamic/basic.stc.dynamic.allocation/p1.cpp
asic/basic.stc/basic.stc.dynamic/basic.stc.dynamic.deallocation/p1.cpp
asic/basic.stc/basic.stc.dynamic/p2-nodef.cpp
asic/basic.stc/basic.stc.dynamic/p2.cpp
lass.access/class.access.dcl/p1.cpp
lass.derived/class.virtual/p12.cpp
lass/class.friend/p1-ambiguous.cpp
lass/class.friend/p1.cpp
lass/class.friend/p2.cpp
lass/class.friend/p6.cpp
lass/class.local/p1.cpp
lass/class.local/p2.cpp
lass/class.local/p3.cpp
lass/class.local/p4.cpp
lass/class.mfct/class.mfct.non-static/p3.cpp
lass/class.nest/p1.cpp
lass/class.nested.type/p1.cpp
lass/class.union/p1.cpp
cl.dcl/basic.namespace/namespace.def/namespace.memdef/p3.cpp
cl.dcl/basic.namespace/namespace.def/namespace.unnamed/p1.cpp
cl.dcl/basic.namespace/namespace.udecl/p1.cpp
cl.dcl/basic.namespace/namespace.udecl/p11.cpp
cl.dcl/basic.namespace/namespace.udecl/p12.cpp
cl.dcl/basic.namespace/namespace.udecl/p13.cpp
cl.dcl/basic.namespace/namespace.udecl/p3-cxx0x.cpp
cl.dcl/basic.namespace/namespace.udecl/p4.cpp
cl.dcl/basic.namespace/namespace.udecl/p5-cxx0x.cpp
cl.dcl/basic.namespace/namespace.udecl/p6-cxx0x.cpp
cl.dcl/basic.namespace/namespace.udecl/p8-cxx0x.cpp
cl.dcl/basic.namespace/namespace.udecl/p8.cpp
cl.dcl/basic.namespace/namespace.udir/p1.cpp
cl.dcl/dcl.spec/dcl.fct.spec/p3.cpp
cl.dcl/dcl.spec/dcl.fct.spec/p4.cpp
cl.dcl/dcl.spec/dcl.fct.spec/p6.cpp
cl.dcl/dcl.spec/dcl.stc/p10.cpp
cl.dcl/dcl.spec/dcl.stc/p9.cpp
cl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p3.cpp
cl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p5.cpp
cl.dcl/dcl.spec/dcl.type/dcl.type.elab/p3.cpp
cl.dcl/dcl.spec/dcl.type/dcl.type.simple/p4-cxx0x.cpp
cl.dcl/dcl.spec/dcl.typedef/p3.cpp
cl.dcl/dcl.spec/dcl.typedef/p4.cpp
cl.decl/dcl.init/dcl.init.aggr/p4.cpp
cl.decl/dcl.init/dcl.init.list/basic.cpp
cl.decl/dcl.init/dcl.init.ref/p1.cpp
cl.decl/dcl.init/dcl.init.ref/p3.cpp
cl.decl/dcl.init/dcl.init.ref/p5-examples.cpp
cl.decl/dcl.init/dcl.init.ref/p5-var.cpp
cl.decl/dcl.meaning/dcl.array/p1-cxx0x.cpp
cl.decl/dcl.meaning/dcl.array/p1.cpp
cl.decl/dcl.meaning/dcl.fct.default/p10.cpp
cl.decl/dcl.meaning/dcl.fct.default/p2.cpp
cl.decl/dcl.meaning/dcl.fct.default/p3.cpp
cl.decl/dcl.meaning/dcl.fct.default/p4.cpp
cl.decl/dcl.meaning/dcl.fct.default/p5.cpp
cl.decl/dcl.meaning/dcl.fct.default/p6.cpp
cl.decl/dcl.meaning/dcl.fct.default/p7.cpp
cl.decl/dcl.meaning/dcl.fct.default/p8.cpp
cl.decl/dcl.meaning/dcl.fct/p3.cpp
cl.decl/dcl.meaning/dcl.mptr/p3.cpp
cl.decl/dcl.meaning/dcl.ref/p5.cpp
xpr/expr.unary/expr.delete/p5.cpp
xpr/p3.cpp
xpr/p8.cpp
xpr/p9.cpp
ex/lex.trigraph/p1.cpp
ex/lex.trigraph/p2.cpp
ex/lex.trigraph/p3.cpp
ver/over.match/over.match.best/p1.cpp
ver/over.over/p1.cpp
ver/over.over/p2.cpp
ver/over.over/p4.cpp
pecial/class.dtor/p2.cpp
pecial/class.free/p1.cpp
pecial/class.free/p6.cpp
emp/temp.decls/temp.class.spec/p6.cpp
emp/temp.decls/temp.class.spec/temp.class.order/p2.cpp
emp/temp.decls/temp.class.spec/temp.class.spec.mfunc/p1-neg.cpp
emp/temp.decls/temp.class.spec/temp.class.spec.mfunc/p1.cpp
emp/temp.decls/temp.class/temp.mem.class/p1.cpp
emp/temp.decls/temp.class/temp.mem.func/p1-retmem.cpp
emp/temp.decls/temp.class/temp.mem.func/p1.cpp
emp/temp.decls/temp.class/temp.mem.func/p1inst.cpp
emp/temp.decls/temp.class/temp.mem.func/pr5056.cpp
emp/temp.decls/temp.class/temp.static/p1-inst.cpp
emp/temp.decls/temp.class/temp.static/p1.cpp
emp/temp.decls/temp.fct/temp.func.order/p4.cpp
emp/temp.decls/temp.fct/temp.func.order/p5.cpp
emp/temp.decls/temp.fct/temp.over.link/p4-neg.cpp
emp/temp.decls/temp.fct/temp.over.link/p4.cpp
emp/temp.decls/temp.fct/temp.over.link/p6.cpp
emp/temp.decls/temp.friend/p1.cpp
emp/temp.decls/temp.friend/p3.cpp
emp/temp.decls/temp.friend/p5.cpp
emp/temp.decls/temp.mem/p1.cpp
emp/temp.fct.spec/temp.arg.explicit/p1.cpp
emp/temp.fct.spec/temp.arg.explicit/p3.cpp
emp/temp.fct.spec/temp.deduct/sfinae-1.cpp
emp/temp.fct.spec/temp.deduct/temp.deduct.call/basic.cpp
emp/temp.fct.spec/temp.deduct/temp.deduct.call/p2.cpp
emp/temp.fct.spec/temp.deduct/temp.deduct.call/p3.cpp
emp/temp.fct.spec/temp.deduct/temp.deduct.conv/p2.cpp
emp/temp.fct.spec/temp.deduct/temp.deduct.conv/p3.cpp
emp/temp.fct.spec/temp.deduct/temp.deduct.conv/p4.cpp
emp/temp.fct.spec/temp.deduct/temp.deduct.funcaddr/p1.cpp
emp/temp.fct.spec/temp.deduct/temp.deduct.partial/p11.cpp
emp/temp.param/p10.cpp
emp/temp.param/p11.cpp
emp/temp.param/p12.cpp
emp/temp.param/p13.cpp
emp/temp.param/p14.cpp
emp/temp.param/p15-cxx0x.cpp
emp/temp.param/p15.cpp
emp/temp.param/p2.cpp
emp/temp.param/p3.cpp
emp/temp.param/p4.cpp
emp/temp.param/p7.cpp
emp/temp.param/p8.cpp
emp/temp.param/p9.cpp
emp/temp.res/temp.dep.res/temp.point/p1.cpp
emp/temp.res/temp.dep/p3.cpp
emp/temp.spec/p5.cpp
emp/temp.spec/temp.expl.spec/p1.cpp
emp/temp.spec/temp.expl.spec/p10.cpp
emp/temp.spec/temp.expl.spec/p11.cpp
emp/temp.spec/temp.expl.spec/p13.cpp
emp/temp.spec/temp.expl.spec/p14.cpp
emp/temp.spec/temp.expl.spec/p15.cpp
emp/temp.spec/temp.expl.spec/p16.cpp
emp/temp.spec/temp.expl.spec/p17.cpp
emp/temp.spec/temp.expl.spec/p18.cpp
emp/temp.spec/temp.expl.spec/p19.cpp
emp/temp.spec/temp.expl.spec/p2.cpp
emp/temp.spec/temp.expl.spec/p20.cpp
emp/temp.spec/temp.expl.spec/p21.cpp
emp/temp.spec/temp.expl.spec/p3.cpp
emp/temp.spec/temp.expl.spec/p4.cpp
emp/temp.spec/temp.expl.spec/p5.cpp
emp/temp.spec/temp.expl.spec/p6.cpp
emp/temp.spec/temp.expl.spec/p9.cpp
emp/temp.spec/temp.explicit/p1-0x.cpp
emp/temp.spec/temp.explicit/p1-emit.cpp
emp/temp.spec/temp.explicit/p1.cpp
emp/temp.spec/temp.explicit/p10.cpp
emp/temp.spec/temp.explicit/p12.cpp
emp/temp.spec/temp.explicit/p2.cpp
emp/temp.spec/temp.explicit/p3.cpp
emp/temp.spec/temp.explicit/p4.cpp
emp/temp.spec/temp.explicit/p5.cpp
emp/temp.spec/temp.explicit/p6.cpp
emp/temp.spec/temp.explicit/p7.cpp
emp/temp.spec/temp.explicit/p8.cpp
emp/temp.spec/temp.explicit/p9-linkage.cpp
emp/temp.spec/temp.explicit/p9.cpp
5cc07df89ab9afa9079baeec1243ee90c3f84d9d 15-Dec-2009 Douglas Gregor <dgregor@apple.com> Fix some diagnostic-related FIXMEs, from Nicola Gigante

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91433 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.spec/temp.explicit/p1.cpp
4b2b02b26cd51e2e44fa315143618285fd72ce77 15-Dec-2009 John McCall <rjmccall@apple.com> Diagnose the use of typedefs for template specialization types in the scope
specifiers for out-of-line declarations, e.g.
typedef Temp<int> MyTemp;
template <> MyTemp::foo;



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91395 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.spec/temp.expl.spec/p17.cpp
5d0d815586860156ec3f49470f972f38b19ad7e2 13-Dec-2009 Anders Carlsson <andersca@mac.com> Fix test.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91245 91177308-0d34-0410-b5e6-96231b3b80d8
asic/basic.stc/basic.stc.dynamic/basic.stc.dynamic.allocation/p1.cpp
156c78e4ef14e5f7ba251554ea8f2dbec573fef3 13-Dec-2009 Anders Carlsson <andersca@mac.com> More improvements to checking allocation and deallocation functions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91244 91177308-0d34-0410-b5e6-96231b3b80d8
asic/basic.stc/basic.stc.dynamic/basic.stc.dynamic.allocation/p1.cpp
20d45d2a9ebb8e20683b11287878a7e341bfea1a 12-Dec-2009 Anders Carlsson <andersca@mac.com> Correctly diagnose [basic.stc.dynamic.allocation]p1

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91190 91177308-0d34-0410-b5e6-96231b3b80d8
asic/basic.stc/basic.stc.dynamic/basic.stc.dynamic.allocation/p1.cpp
9d59ecb4d2c2e8efdb214589753826b662246d82 12-Dec-2009 Anders Carlsson <andersca@mac.com> Improve diagnostics for malformed delete operator function declarations.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91180 91177308-0d34-0410-b5e6-96231b3b80d8
asic/basic.stc/basic.stc.dynamic/basic.stc.dynamic.deallocation/p1.cpp
pecial/class.free/p6.cpp
a970c57771c362c78925e9a9740a02bbf7d4b921 11-Dec-2009 John McCall <rjmccall@apple.com> Test member template using hiding.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91099 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/basic.namespace/namespace.udecl/p12.cpp
d7533ec10b618d360eb8952e62edb5657199acd3 11-Dec-2009 John McCall <rjmccall@apple.com> Check if the target of a using decl is already declared in this scope before
doing any of the other redeclaration checks. We were missing a few cases.
Fixes PR 5752.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91096 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/basic.namespace/namespace.udecl/p10.cpp
60fa3cfd7aa63c29f9fc2d593bac56a3646337cc 11-Dec-2009 John McCall <rjmccall@apple.com> Implement access declarations. Most of the work here is parsing them, which
is difficult because they're so terribly, terribly ambiguous.


We implement access declarations in terms of using declarations, which is
quite reasonable. However, we should really persist the access/using
distinction in the AST and use the appropriate name in diagnostics. This
isn't a priority, so I'll just file a PR and hope someone else does it. :)


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91095 91177308-0d34-0410-b5e6-96231b3b80d8
lass.access/class.access.dcl/p1.cpp
35dfab9cb14b7d368e4922dce786a5e046a61420 10-Dec-2009 John McCall <rjmccall@apple.com> Actually try to trigger the last diagnostic in the declaration-collision test case.
Surprisingly, we *do* diagnose one of them. Since we don't really track scopes into
instantiation, this has to signal some kind of bug.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91063 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/basic.namespace/namespace.udecl/p11.cpp
41ce66f8e20159d8bd39fff54ae01608da06c294 10-Dec-2009 John McCall <rjmccall@apple.com> Improve the diagnostic when a new declaration conflicts with a using shadow
declaration. Rename note_using_decl to note_using, which is possibly less confusing.
Add a test for non-class-scope using decl collisions and be sure to note the case
we can't diagnose yet.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91057 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/basic.namespace/namespace.udecl/p11.cpp
d87b61f6398bab21176f73818a8d11ca1c3632c8 10-Dec-2009 Douglas Gregor <dgregor@apple.com> Move initialization via initializer list over to InitializationSequences.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91050 91177308-0d34-0410-b5e6-96231b3b80d8
cl.decl/dcl.init/dcl.init.list/basic.cpp
9f54ad4381370c6b771424b53d219e661d6d6706 10-Dec-2009 John McCall <rjmccall@apple.com> Implement redeclaration checking and hiding semantics for using declarations. There
are a couple of O(n^2) operations in this, some analogous to the usual O(n^2)
redeclaration problem and some not. In particular, retroactively removing
shadow declarations when they're hidden by later decls is pretty unfortunate.
I'm not yet convinced it's worse than the alternative, though.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91045 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/basic.namespace/namespace.udecl/p10.cpp
cl.dcl/basic.namespace/namespace.udecl/p12.cpp
cl.dcl/basic.namespace/namespace.udecl/p8.cpp
20093b4bf698f292c664676987541d5103b65b15 10-Dec-2009 Douglas Gregor <dgregor@apple.com> Reimplement reference initialization (C++ [dcl.init.ref]) using the
new notion of an "initialization sequence", which encapsulates the
computation of the initialization sequence along with diagnostic
information and the capability to turn the computed sequence into an
expression. At present, I've only switched one CheckReferenceInit
callers over to this new mechanism; more will follow.

Aside from (hopefully) being much more true to the standard, the
diagnostics provided by this reference-initialization code are a bit
better than before. Some examples:

p5-var.cpp:54:12: error: non-const lvalue reference to type 'struct
Derived'
cannot bind to a value of unrelated type 'struct Base'
Derived &dr2 = b; // expected-error{{non-const lvalue reference to
...
^ ~
p5-var.cpp:55:9: error: binding of reference to type 'struct Base' to
a value of
type 'struct Base const' drops qualifiers
Base &br3 = bc; // expected-error{{drops qualifiers}}
^ ~~

p5-var.cpp:57:15: error: ambiguous conversion from derived class
'struct Diamond' to base class 'struct Base':
struct Diamond -> struct Derived -> struct Base
struct Diamond -> struct Derived2 -> struct Base
Base &br5 = diamond; // expected-error{{ambiguous conversion from
...
^~~~~~~
p5-var.cpp:59:9: error: non-const lvalue reference to type 'long'
cannot bind to
a value of unrelated type 'int'
long &lr = i; // expected-error{{non-const lvalue reference to type
...
^ ~

p5-var.cpp:74:9: error: non-const lvalue reference to type 'struct
Base' cannot
bind to a temporary of type 'struct Base'
Base &br1 = Base(); // expected-error{{non-const lvalue reference to
...
^ ~~~~~~

p5-var.cpp:102:9: error: non-const reference cannot bind to bit-field
'i'
int & ir1 = (ib.i); // expected-error{{non-const reference cannot
...
^ ~~~~~~
p5-var.cpp:98:7: note: bit-field is declared here
int i : 17; // expected-note{{bit-field is declared here}}
^






git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90992 91177308-0d34-0410-b5e6-96231b3b80d8
cl.decl/dcl.init/dcl.init.ref/p1.cpp
cl.decl/dcl.init/dcl.init.ref/p3.cpp
cl.decl/dcl.init/dcl.init.ref/p5-examples.cpp
cl.decl/dcl.init/dcl.init.ref/p5-var.cpp
fead20c1de136b5a199a5cc4225f64be771452e4 08-Dec-2009 John McCall <rjmccall@apple.com> Handle unresolved using decls in bare lookups. These are not being adequately
tested. Fixes PR5727.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90893 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/basic.namespace/namespace.udecl/p12.cpp
604e7f14d672af80ca5b9044f30f3dc23d37ddd5 08-Dec-2009 John McCall <rjmccall@apple.com> Correctly implement the C++03 and 0x restrictions on class-member using
declarations.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90843 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/basic.namespace/namespace.udecl/p3-cxx0x.cpp
cl.dcl/basic.namespace/namespace.udecl/p4.cpp
fa184a46526eca735e08a483bba56a5d69fc4b5b 07-Dec-2009 Douglas Gregor <dgregor@apple.com> Remove empty test cases

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90749 91177308-0d34-0410-b5e6-96231b3b80d8
cl.decl/dcl.init/dcl.init.ref/p1.cpp
cl.decl/dcl.init/dcl.init.ref/p3.cpp
cl.decl/dcl.init/dcl.init.ref/p5-var.cpp
d490f953e812a9bb1729637cc70a6db7d997ced0 06-Dec-2009 Douglas Gregor <dgregor@apple.com> PointerUnion == PointerUnion does not do what I thought it did. Also, fix a thinko in a PointerUnion::get call.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90719 91177308-0d34-0410-b5e6-96231b3b80d8
cl.decl/dcl.init/dcl.init.ref/p1.cpp
cl.decl/dcl.init/dcl.init.ref/p3.cpp
cl.decl/dcl.init/dcl.init.ref/p5-var.cpp
ed97649e9574b9d854fa4d6109c9333ae0993554 04-Dec-2009 John McCall <rjmccall@apple.com> Fix "using typename" and the instantiation of non-dependent using declarations.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90614 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/basic.namespace/namespace.udecl/p4.cpp
701c89e02cde6e0fb9673cbe7c97eadc74b50358 03-Dec-2009 John McCall <rjmccall@apple.com> Honor using declarations in overload resolution. Most of the code for
overloaded-operator resolution is wildly untested, but the parallel code for
methods seems to satisfy some trivial tests.

Also change some overload-resolution APIs to take a type instead of an expression,
which lets us avoid creating a spurious CXXThisExpr when resolving implicit
member accesses.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90410 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/basic.namespace/namespace.udecl/p13.cpp
144238edd9349029ae845eefd082224b656359a8 02-Dec-2009 John McCall <rjmccall@apple.com> Use a more rigorous definition of 'class member'. I don't have any evidence
that this was causing a problem, but it could have.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90343 91177308-0d34-0410-b5e6-96231b3b80d8
asic/basic.lookup/basic.lookup.argdep/p3.cpp
2f841ba3b3fd6babe751667470735651907b4001 02-Dec-2009 John McCall <rjmccall@apple.com> Stop trying to analyze class-hierarchies for dependently-scoped id-expressions;
there's nothing interesting we can say now that we're correctly not requiring
the qualifier to name a known base class in dependent contexts.

Require scope specifiers on member access expressions to name complete types
if they're not dependent; delay lookup when they are dependent.

Use more appropriate diagnostics when qualified implicit member access
expressions find declarations from unrelated classes.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90289 91177308-0d34-0410-b5e6-96231b3b80d8
lass/class.mfct/class.mfct.non-static/p3.cpp
d85b5b9b8fcf53906d9a61649b3657ca0d902017 25-Nov-2009 Douglas Gregor <dgregor@apple.com> Implement the rules in C++ [basic.link] and C99 6.2.2 for computing
the linkage of a declaration. Switch the lame (and completely wrong)
NamedDecl::hasLinkage() over to using the new NamedDecl::getLinkage(),
along with the "can this declaration be a template argument?" check
that started all of this.

Fixes -fsyntax-only for PR5597.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89891 91177308-0d34-0410-b5e6-96231b3b80d8
asic/basic.link/p9.cpp
abe36e26a5978e14f6e8ed62a47400f1c0ffbb4d 25-Nov-2009 Douglas Gregor <dgregor@apple.com> Tweak expected error message, although we still fail this test

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89875 91177308-0d34-0410-b5e6-96231b3b80d8
asic/basic.lookup/basic.lookup.unqual/p15.cpp
5b6d70e2dece713de82612ffbac2f2bc5c367f73 25-Nov-2009 Douglas Gregor <dgregor@apple.com> Diagnose ill-formed uses of default template arguments in
function templates (in C++98), friend function templates, and
out-of-line definitions of members of class templates.

Also handles merging of default template arguments from previous
declarations of function templates, for C++0x. However, we don't yet
make use of those default template arguments.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89872 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.param/p9.cpp
74295b3408178bd0e97c2090dac911817778b582 23-Nov-2009 Douglas Gregor <dgregor@apple.com> Canonical template arguments that are template template parameters by
their template parameter depth and position, so that we can match
redeclarations appropriately. Fixes PR5527 and PR5528.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89654 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.class/temp.mem.func/p1.cpp
ba13543329afac4a0d01304ec2ec4924d99306a6 21-Nov-2009 John McCall <rjmccall@apple.com> "Incremental" progress on using expressions, by which I mean totally ripping
into pretty much everything about overload resolution in order to wean
BuildDeclarationNameExpr off LookupResult::getAsSingleDecl(). Replace
UnresolvedFunctionNameExpr with UnresolvedLookupExpr, which generalizes the
idea of a non-member lookup that we haven't totally resolved yet, whether by
overloading, argument-dependent lookup, or (eventually) the presence of
a function template in the lookup results.

Incidentally fixes a problem with argument-dependent lookup where we were
still performing ADL even when the lookup results contained something from
a block scope.

Incidentally improves a diagnostic when using an ObjC ivar from a class method.
This just fell out from rewriting BuildDeclarationNameExpr's interaction with
lookup, and I'm too apathetic to break it out.

The only remaining uses of OverloadedFunctionDecl that I know of are in
TemplateName and MemberExpr.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89544 91177308-0d34-0410-b5e6-96231b3b80d8
cl.decl/dcl.meaning/dcl.fct.default/p4.cpp
98440b4ac17dc5f85ea3db683c1c1785449c17e1 21-Nov-2009 Douglas Gregor <dgregor@apple.com> Implement C++ [temp.param]p2 correctly, looking ahead when we see a
"typename" parameter to distinguish between non-type and type template
parameters. Fixes the actual bug in PR5559.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89532 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.param/p2.cpp
a481edb1b11c956a46cb42cd0dc4dd9851c10801 21-Nov-2009 Douglas Gregor <dgregor@apple.com> Cope with extraneous "template" keyword when providing an out-of-line
definition of a member template (or a member thereof). Fixes PR5566.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89512 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.class.spec/temp.class.spec.mfunc/p1.cpp
emp/temp.decls/temp.class/temp.mem.func/p1.cpp
65bdbfa6ca6b9a1170e052cc567d098d0f99cdae 18-Nov-2009 Sebastian Redl <sebastian.redl@getdesigned.at> Pretend destructors are const and volatile. This allows calling them with const and/or volatile objects. Fixes PR5548.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89244 91177308-0d34-0410-b5e6-96231b3b80d8
pecial/class.dtor/p2.cpp
cc5306ac8a39cdd5e7f83e597cba911e97c4a595 18-Nov-2009 Fariborz Jahanian <fjahanian@apple.com> Improve on diagnosing type mismatches because of
lack of viable convesion functions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89216 91177308-0d34-0410-b5e6-96231b3b80d8
asic/basic.lookup/basic.lookup.qual/namespace.qual/p2.cpp
cl.dcl/basic.namespace/namespace.udecl/p1.cpp
7ba107a1863ddfa1664555854f0d7bdb3c491c92 18-Nov-2009 John McCall <rjmccall@apple.com> Incremental progress on using declarations. Split UnresolvedUsingDecl into
two classes, one for typenames and one for values; this seems to have some
support from Doug if not necessarily from the extremely-vague-on-this-point
standard. Track the location of the 'typename' keyword in a using-typename
decl. Make a new lookup result for unresolved values and deal with it in
most places.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89184 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/basic.namespace/namespace.udecl/p1.cpp
48270a36749b7f10677a514a03bbd2cf90697d58 17-Nov-2009 John McCall <rjmccall@apple.com> Commit this random test case.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89068 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/basic.namespace/namespace.udecl/p1.cpp
1f126bd18c85ea129c3897f8729cebb090917d01 15-Nov-2009 Anders Carlsson <andersca@mac.com> Deallocation functions must also be static.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@88859 91177308-0d34-0410-b5e6-96231b3b80d8
pecial/class.free/p6.cpp
67bf2e7706b82d5debd5c189d9454130df7db0d8 15-Nov-2009 Anders Carlsson <andersca@mac.com> allocation functions are always static.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@88858 91177308-0d34-0410-b5e6-96231b3b80d8
pecial/class.free/p1.cpp
ba69b3c1050447db3c91a41ff25ce8cd29d9b021 14-Nov-2009 Daniel Dunbar <daniel@zuster.org> Fix broken tests, exposed by improved -verify.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@88749 91177308-0d34-0410-b5e6-96231b3b80d8
cl.decl/dcl.meaning/dcl.mptr/p3.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/expr.unary/expr.delete/p5.cpp
f35f828f9883123772a9731af190a608f3236ef4 11-Nov-2009 Douglas Gregor <dgregor@apple.com> Improve diagnostics when a default template argument does not match
with its corresponding template parameter. This can happen when we
performed some substitution into the default template argument and
what we had doesn't match any more, e.g.,

template<int> struct A;
template<typename T, template<T> class X = A> class B;

B<long> b;

Previously, we'd emit a pretty but disembodied diagnostic showing how
the default argument didn't match the template parameter. The
diagnostic was good, but nothing tied it to the *use* of the default
argument in "B<long>". This commit fixes that.

Also, tweak the counting of active template instantiations to avoid
counting non-instantiation records, such as those we create for
(surprise!) checking default arguments, instantiating default
arguments, and performing substitutions as part of template argument
deduction.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86884 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.param/p12.cpp
9148c3f5829f4d031249faeb1043e7be914539e8 11-Nov-2009 Douglas Gregor <dgregor@apple.com> Before checking a template template argument against its corresponding
template template parameter, substitute any prior template arguments
into the template template parameter. This, for example, allows us to
properly check the template template argument for a class such as:

template<typename T, template<T Value> class X> struct Foo;

The actual implementation of this feature was trivial; most of the
change is dedicated to giving decent diagnostics when this
substitution goes horribly wrong. We now get a note like:

note: while substituting prior template arguments into template
template parameter 'X' [with T = float]

As part of this change, enabled some very pedantic checking when
comparing template template parameter lists, which shook out a bug in
our overly-eager checking of default arguments of template template
parameters. We now perform only minimal checking of such default
arguments when they are initially parsed.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86864 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.param/p12.cpp
f7f3d0db754db0500b56d49ac19f795f13965912 11-Nov-2009 John McCall <rjmccall@apple.com> Create a new Scope when parsing a declaration with a C++ scope specifier.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86764 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/basic.namespace/namespace.udir/p1.cpp
12ea5780e7729de3fee009525e49468fd8d0b713 10-Nov-2009 John McCall <rjmccall@apple.com> Make a somewhat more convincing test case for unqualified lookup through
using directives, and fix a bug thereby exposed: since we're playing
tricks with pointers, we need to make certain we're always using the same
pointers for things.
Also tweak an existing error message.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86679 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/basic.namespace/namespace.udir/p1.cpp
cdc89c485cde6aaa8c8e83f920cb25ddf7876a75 10-Nov-2009 John McCall <rjmccall@apple.com> Simple test case for [basic.lookup.udir].



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86674 91177308-0d34-0410-b5e6-96231b3b80d8
asic/basic.lookup/basic.lookup.udir/p1.cpp
d7be78a0524251c30329359c9d92485c6d7ac424 10-Nov-2009 John McCall <rjmccall@apple.com> Fix unqualified lookup through using directives.

This is a pretty minimal test case; I'll make a better one later.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86669 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/basic.namespace/namespace.def/namespace.unnamed/p1.cpp
80c30dad6c6fca077293125a96f464b6c8857171 09-Nov-2009 Eli Friedman <eli.friedman@gmail.com> Add additional note to mark the cause of synthesized constructors. Mark
declaration invalid if the constructor can't be properly built. Addresses
remaining review comments from Fariborz for r86500.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86579 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.spec/temp.expl.spec/p4.cpp
49c16da71b9c95cc53b4af6de2833a022cb69b6a 09-Nov-2009 Eli Friedman <eli.friedman@gmail.com> Unify the codepaths used to verify base and member initializers for explicitly
and implicitly defined constructors. This has a number of benefits:

1. Less code.

2. Explicit and implicit constructors get the same diagnostics.

3. The AST explicitly contains constructor calls from implicit default
constructors. This allows handing some cases that previously weren't handled
correctly in IRGen without any additional code. Specifically, implicit default
constructors containing calls to constructors with default arguments are now
handled correctly.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86500 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.spec/temp.expl.spec/p4.cpp
2475d76920b43014e661690836642ca3c9967179 08-Nov-2009 Daniel Dunbar <daniel@zuster.org> Remove RUN: true lines.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86432 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.param/p1.cpp
4fcfde4d5c8f25e40720972a5543d538a0dcb220 08-Nov-2009 Daniel Dunbar <daniel@zuster.org> Eliminate &&s in tests.
- 'for i in $(find . -type f); do sed -e 's#\(RUN:.*[^ ]\) *&& *$#\1#g' $i | FileUpdate $i; done', for the curious.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86430 91177308-0d34-0410-b5e6-96231b3b80d8
cl.decl/dcl.meaning/dcl.fct.default/p4.cpp
cl.decl/dcl.meaning/dcl.fct/p3.cpp
emp/temp.spec/temp.expl.spec/p3.cpp
6e8247556807ecaaac470852222762db998a05b2 05-Nov-2009 Sebastian Redl <sebastian.redl@getdesigned.at> Don't allow definitions of array variables without some size information in C++. Fixed PR5401

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86165 91177308-0d34-0410-b5e6-96231b3b80d8
cl.decl/dcl.meaning/dcl.array/p1.cpp
923d56d436f750bc1f29db50e641078725558a1b 05-Nov-2009 Sebastian Redl <sebastian.redl@getdesigned.at> Allow the element type of arrays to be incomplete in C++.
This fixes PR5048. Also fix a bug where zero-sized arrays weren't warned about when the size was unsigned.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86136 91177308-0d34-0410-b5e6-96231b3b80d8
cl.decl/dcl.meaning/dcl.array/p1.cpp
12c118a8ff9f61a4d63146fe1a5c0d60987f99bb 04-Nov-2009 Douglas Gregor <dgregor@apple.com> Switch parsing of using declarations over to ParseUnqualifiedId.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86027 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/basic.namespace/namespace.udecl/p5-cxx0x.cpp
d73902121a93c3135cf53e2d724361cec1037d7e 03-Nov-2009 Daniel Dunbar <daniel@zuster.org> Switch XFAIL format to match LLVM.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85880 91177308-0d34-0410-b5e6-96231b3b80d8
asic/basic.lookup/basic.lookup.unqual/p14.cpp
asic/basic.lookup/basic.lookup.unqual/p15.cpp
cl.dcl/dcl.spec/dcl.fct.spec/p3.cpp
cl.dcl/dcl.spec/dcl.fct.spec/p4.cpp
cl.dcl/dcl.spec/dcl.fct.spec/p6.cpp
cl.dcl/dcl.spec/dcl.stc/p10.cpp
cl.dcl/dcl.spec/dcl.typedef/p4.cpp
emp/temp.param/p14.cpp
emp/temp.res/temp.dep.res/temp.point/p1.cpp
3f9a0566e6793151b99a65ab936220971cf96c1b 03-Nov-2009 Douglas Gregor <dgregor@apple.com> Introduce a new class, UnqualifiedId, that provides a parsed
representation of a C++ unqualified-id, along with a single parsing
function (Parser::ParseUnqualifiedId) that will parse all of the
various forms of unqualified-id in C++.

Replace the representation of the declarator name in Declarator with
the new UnqualifiedId class, simplifying declarator-id parsing
considerably and providing more source-location information to
Sema. In the future, I hope to migrate all of the other
unqualified-id-parsing code over to this single representation, then
begin to merge actions that are currently only different because we
didn't have a unqualified notion of the name in the parser.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85851 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.spec/temp.explicit/p3.cpp
c78c06d81f9838aea4198e4965cc1b26bb0bf838 30-Oct-2009 Douglas Gregor <dgregor@apple.com> Improved fix for PR3844, which recovers better for class template
partial specializations and explicit instantiations of non-templates.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85620 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.spec/temp.explicit/p5.cpp
2cc782f7932f1069d9fa8bb5c518165802aad68d 30-Oct-2009 Douglas Gregor <dgregor@apple.com> Improve diagnostics when parsing something like

template<> struct foo<int> { ... };

where "foo" does not refer to a template. Fixes PR3844.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85616 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.spec/temp.expl.spec/p3.cpp
emp/temp.spec/temp.explicit/p5.cpp
e8c01bdb56549adcecd71ce39160eea54b2c51c8 30-Oct-2009 Douglas Gregor <dgregor@apple.com> Instantiate class template friends better; fixes PR5332.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85612 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.friend/p5.cpp
85737a71fee8c737f7cfba79a0aca89298fe573b 30-Oct-2009 John McCall <rjmccall@apple.com> Report accurate source-location information when rebuilding types during
template instantiation.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85545 91177308-0d34-0410-b5e6-96231b3b80d8
cl.decl/dcl.meaning/dcl.ref/p5.cpp
ed9c0f90b7e0811c209b95e39fe07c211c531285 29-Oct-2009 Douglas Gregor <dgregor@apple.com> Implement support for semantic checking and template instantiation of
class template partial specializations of member templates. Also,
fixes a silly little bug in the marking of "used" template parameters
in member templates. Fixes PR5236.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85447 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.class.spec/p6.cpp
268fb5bca1372e6dcd39a3d8d5a29341915ed919 28-Oct-2009 Douglas Gregor <dgregor@apple.com> Test
explicit-instantiation-declaration-after-explicit-instantiation-definition
errors. This wraps up explicit template instantiation for now.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85347 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.spec/temp.explicit/p10.cpp
7d9c3c92c90ae36d58ec21bc53c4c08e02ac3555 28-Oct-2009 Douglas Gregor <dgregor@apple.com> Implement proper linkage for explicit instantiation declarations of
inlined functions. For example, given

template<typename T>
class string {
unsigned Len;

public:
unsigned size() const { return Len; }
};

extern template class string<char>;

we now give the instantiation of string<char>::size
available_externally linkage (if it is ever instantiated!), as
permitted by the C++0x standard.




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85340 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.spec/temp.explicit/p9-linkage.cpp
3b846b6c252972a6f142aa226c1e65aebd0feeca 27-Oct-2009 Douglas Gregor <dgregor@apple.com> Explicit instantiation suppresses the instantiation of non-inline
function template specializations and member functions of class
template specializations.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85300 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.spec/temp.explicit/p9.cpp
0d03514da06dffb39a260a1228ea3fd01d196fa4 27-Oct-2009 Douglas Gregor <dgregor@apple.com> An explicit instantiation definition only instantiations those class
members that have a definition. Also, use
CheckSpecializationInstantiationRedecl as part of this instantiation
to make sure that we diagnose the various kinds of problems that can
occur with explicit instantiations.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85270 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.spec/temp.explicit/p8.cpp
7d5ba55f58c070e5b9f8cee3a172e2da1fcd02af 27-Oct-2009 Douglas Gregor <dgregor@apple.com> Test for interaction between explicit instantiations and specializations

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85244 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.spec/temp.explicit/p7.cpp
e46c7f524297452e1c9800792e403beca6c92a1a 27-Oct-2009 Douglas Gregor <dgregor@apple.com> Test various aspects of explicit instantiation that were already implemented.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85243 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.spec/temp.explicit/p12.cpp
emp/temp.spec/temp.explicit/p5.cpp
emp/temp.spec/temp.explicit/p6.cpp
972e6ce33c7e307f4b0da12bd6079bbd6ef76948 27-Oct-2009 Douglas Gregor <dgregor@apple.com> Only set the point of instantiation for an implicit or explicit
instantiation once we have committed to performing the
instantiation. As part of this, make our makeshift
template-instantiation location information suck slightly less.

Fixes PR5264.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85209 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.spec/temp.explicit/p3.cpp
38fd4d001182b0b125a42c3b7e83e9dbac50e8a5 25-Oct-2009 Sebastian Redl <sebastian.redl@getdesigned.at> Make sure we actually have a definition before asking if it is implicit. Fixes PR4674.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85072 91177308-0d34-0410-b5e6-96231b3b80d8
lass/class.union/p1.cpp
d75191f0d100b596281f99ea8f2f0a0d0560d969 17-Oct-2009 Sebastian Redl <sebastian.redl@getdesigned.at> In some dependent contexts, incomplete array types persist into FinalizeDeclaratorGroup. Don't require them to have a complete type. This allows us to compile Hello World with the Apache stdcxx library. If you don't use endl, it even links and runs.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84347 91177308-0d34-0410-b5e6-96231b3b80d8
cl.decl/dcl.init/dcl.init.aggr/p4.cpp
583f33b8a9227bace1a77a15404b4c64dc619d69 15-Oct-2009 Douglas Gregor <dgregor@apple.com> Make sure that we're diagnosing duplicate explicit instantiation definitions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84189 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.spec/p5.cpp
454885ec4f59959a01a2c7861b88abdea8617147 15-Oct-2009 Douglas Gregor <dgregor@apple.com> Check the interactions between explicit instantiations and template
specializations. Work in progress; there's more cleanup required to
actually use the new CheckSpecializationInstantiationRedecl checker
uniformly.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84185 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.spec/temp.explicit/p4.cpp
e2d3a3de71b2fa35614cb732a6da95a41fa38ad9 15-Oct-2009 Douglas Gregor <dgregor@apple.com> Diagnose explicit instantiations of function templates and member
functions/static data members of class template specializations that
do not have definitions. This is the latter part of [temp.explicit]p4;
the former part still needs more testing.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84182 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.spec/temp.explicit/p1-0x.cpp
emp/temp.spec/temp.explicit/p2.cpp
emp/temp.spec/temp.explicit/p4.cpp
bf7643e7966cd9acd797a84870018034112e49d3 15-Oct-2009 Douglas Gregor <dgregor@apple.com> More explicit template instantiation. Now we're checking for more
cases where an explicit instantiation requires a definition; the
remainder of these checks will come with the implementation of
paragraph 4 of [temp.explicit].


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84181 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.spec/temp.explicit/p3.cpp
558c03222c77873a934b002073667a3c971fe8a9 15-Oct-2009 Douglas Gregor <dgregor@apple.com> Additional semantic checking for explicit template instantiations,
focusing on the scope- and qualifier-related semantic requirements in
C++ [temp.explicit]p2.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84154 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.spec/temp.explicit/p2.cpp
9ada570e77bdd8334a86528b07e5569d00750b3c 14-Oct-2009 Douglas Gregor <dgregor@apple.com> Check the implicit instantiation of a static data member of a class
template that has no out-of-line definition.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84141 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.spec/temp.explicit/p1-emit.cpp
1028c9f0afc1cc5f4951b39b7067fa57c1fea07b 14-Oct-2009 Douglas Gregor <dgregor@apple.com> Give explicit and implicit instantiations of static data members of
class templates the proper linkage.

Daniel, please look over the CodeGenModule bits.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84140 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.spec/temp.explicit/p1-emit.cpp
663b5a0be7261c29bc4c526a71cffcfa02d4153e 14-Oct-2009 Douglas Gregor <dgregor@apple.com> Testing and some minor fixes for explicit template instantiation.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84129 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.spec/temp.explicit/p1-0x.cpp
emp/temp.spec/temp.explicit/p1.cpp
a786fdbf6c1d8ff08c3e61c7eb6bf2872895e2b4 14-Oct-2009 Douglas Gregor <dgregor@apple.com> Improve diagnostics when the parser encounters a declarator with an
unknown type name, e.g.,

foo::bar x;

when "bar" does not refer to a type in "foo".

With this change, the parser now calls into the action to perform
diagnostics and can try to recover by substituting in an appropriate
type. For example, this allows us to easily diagnose some missing
"typename" specifiers, which we now do:

test/SemaCXX/unknown-type-name.cpp:29:1: error: missing 'typename'
prior to dependent type name 'A<T>::type'
A<T>::type A<T>::f() { return type(); }
^~~~~~~~~~
typename

Fixes PR3990.





git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84053 91177308-0d34-0410-b5e6-96231b3b80d8
lass/class.friend/p1.cpp
3f09327b26033d0a9676d52d80cf92c48f581aff 13-Oct-2009 Douglas Gregor <dgregor@apple.com> Unify our diagnostic printing for errors of the form, "we didn't like
what we found when we looked into <blah>", where <blah> is a
DeclContext*. We can now format DeclContext*'s in nice ways, e.g.,
"namespace N", "the global namespace", "'class Foo'".

This is part of PR3990, but we're not quite there yet.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84028 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.spec/temp.expl.spec/p18.cpp
096ebfda90b35a5cd6e399920fca7d9b5b0859f3 13-Oct-2009 Douglas Gregor <dgregor@apple.com> Diagnose attempts to add default function arguments to a
specialization. This completes C++ [temp.expl.spec]!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83980 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.spec/temp.expl.spec/p21.cpp
fd056bc86a8b22a9421b5d921bbca276d0f9d0f7 13-Oct-2009 Douglas Gregor <dgregor@apple.com> When explicitly specializing a member that is a template, mark the
template as a specialization. For example, this occurs with:

template<typename T>
struct X {
template<typename U> struct Inner { /* ... */ };
};

template<> template<typename T>
struct X<int>::Inner {
T member;
};

We need to treat templates that are member specializations as special
in two contexts:

- When looking for a definition of a member template, we look
through the instantiation chain until we hit the primary template
*or a member specialization*. This allows us to distinguish
between the primary "Inner" definition and the X<int>::Inner
definition, above.
- When computing all of the levels of template arguments needed to
instantiate a member template, don't add template arguments
from contexts outside of the instantiation of a member
specialization, since the user has already manually substituted
those arguments.

Fix up the existing test for p18, which was actually wrong (but we
didn't diagnose it because of our poor handling of member
specializations of templates), and add a new test for member
specializations of templates.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83974 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.spec/temp.expl.spec/p18.cpp
emp/temp.spec/temp.expl.spec/p19.cpp
a735b206fdb5c15767a45289e1ffb3b568f70f2b 13-Oct-2009 Douglas Gregor <dgregor@apple.com> Improve the internal representation and semantic analysis of friend
function templates.

This commit ensures that friend function templates are constructed as
FunctionTemplateDecls rather than partial FunctionDecls (as they
previously were). It then implements template instantiation for friend
function templates, injecting the friend function template only when
no previous declaration exists at the time of instantiation.

Oh, and make sure that explicit specialization declarations are not
friends.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83970 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.spec/temp.expl.spec/p20.cpp
f0510d49a6985e9284d30cfc36a0df2a6292a638 13-Oct-2009 Douglas Gregor <dgregor@apple.com> When declaring a class template whose name is qualified, make sure
that the scope in which it is being declared is complete. Also, when
instantiating a member class template's ClassTemplateDecl, be sure to
delay type creation so that the resulting type is dependent. Ick.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83923 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.spec/temp.expl.spec/p18.cpp
38d840486d2b4ecafd32af9ad48f594f5cdb6199 13-Oct-2009 Douglas Gregor <dgregor@apple.com> Test explicit specialization involving multiple template<> headers

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83914 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.spec/temp.expl.spec/p17.cpp
37d68185088947322a97eabdc1c0714b0debd929 13-Oct-2009 Douglas Gregor <dgregor@apple.com> Permit explicit specialization of member functions of class templates
that are declarations (rather than definitions). Also, be sure to set
the access specifiers properly when instantiating the declarations of
member function templates.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83911 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.spec/temp.expl.spec/p16.cpp
65f6642e88ac39f2c1129f9b92b3fafd55dc32df 12-Oct-2009 Douglas Gregor <dgregor@apple.com> Test explicit specializations of static data members that are declarations, not definitions

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83904 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.spec/temp.expl.spec/p15.cpp
27c8235def85fc7f92fcaffe7907eef0552ca209 12-Oct-2009 Douglas Gregor <dgregor@apple.com> Yet another test for explicit specialization, this one involving linkage

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83901 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.spec/temp.expl.spec/p14.cpp
09748395ab88f7f4678c9ff048fd035174dba519 12-Oct-2009 Douglas Gregor <dgregor@apple.com> More tests for explicit template specialization

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83896 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.spec/temp.expl.spec/p10.cpp
emp/temp.spec/temp.expl.spec/p11.cpp
emp/temp.spec/temp.expl.spec/p13.cpp
emp/temp.spec/temp.expl.spec/p9.cpp
459180b1eb2a8db03cc996bc33e320e5ee44daca 12-Oct-2009 Douglas Gregor <dgregor@apple.com> Add test for last commit

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83893 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.spec/temp.expl.spec/p6.cpp
6e24726524c2b51b31bb4b622aa678a46b024f42 10-Oct-2009 John McCall <rjmccall@apple.com> Qualified lookup through using declarations. Diagnose a new type of ambiguity.
Split the various ambiguous result enumerators into their own enum. Tests
for most of C++ [namespace.qual].



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83700 91177308-0d34-0410-b5e6-96231b3b80d8
asic/basic.lookup/basic.lookup.qual/namespace.qual/p2.cpp
asic/basic.lookup/basic.lookup.qual/namespace.qual/p3.cpp
asic/basic.lookup/basic.lookup.qual/namespace.qual/p4.cpp
asic/basic.lookup/basic.lookup.qual/namespace.qual/p5.cpp
8c8d91917c307dc3ba4f60661377c745f2a6bef2 10-Oct-2009 Anders Carlsson <andersca@mac.com> Add CheckCallReturnType and start using it for regular call expressions. This will improve error messages. For

struct B;

B f();

void g() {
f();
}

We now get

t.cpp:6:3: error: calling 'f' with incomplete return type 'struct B'
f();
^~~
t.cpp:3:3: note: 'f' declared here
B f();
^
t.cpp:1:8: note: forward declaration of 'struct B'
struct B;
^



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83692 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/dcl.spec/dcl.stc/p9.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
xpr/p3.cpp
xpr/p8.cpp
xpr/p9.cpp
0c728f1eb2e8e6e5adc2501c6fdcd87105b34d5c 09-Oct-2009 Fariborz Jahanian <fjahanian@apple.com> Fix up error reporting when object cannot be constructed
because of missing default constructor of a member.
Fixes pr5154.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83583 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.spec/temp.expl.spec/p4.cpp
9916a047c55ea18845d706bf95e7517b646933d0 08-Oct-2009 Douglas Gregor <dgregor@apple.com> Add more testing for the properties of explicit specialization.

Also, eliminate a redundant diagnostic by marking a variable declared
with incomplete type as an invalid declaration.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83553 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.spec/temp.expl.spec/p3.cpp
emp/temp.spec/temp.expl.spec/p4.cpp
emp/temp.spec/temp.expl.spec/p5.cpp
741fab61570f145a52b808a6824841c41e892c28 08-Oct-2009 Douglas Gregor <dgregor@apple.com> Don't complain about out-of-line explicit specializations of member
function and member function templates that are not definitions. Add
more tests to ensure that explicit specializations of member function
templates prevent instantiation.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83550 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.spec/temp.expl.spec/p2.cpp
42887b9224e1d47372fb8a00cba27c925924fa52 08-Oct-2009 Douglas Gregor <dgregor@apple.com> More testing for explicit specializations of member class templates

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83548 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.spec/temp.expl.spec/p2.cpp
f6b1185f0a8a209c06dfc1efdb6a59cc851e970c 08-Oct-2009 Douglas Gregor <dgregor@apple.com> Improve checking for specializations of member classes of class
templates, and keep track of how those member classes were
instantiated or specialized.

Make sure that we don't try to instantiate an explicitly-specialized
member class of a class template, when that explicit specialization
was a declaration rather than a definition.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83547 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.spec/temp.expl.spec/p2.cpp
251b4ff2578e26959a4c036140ccd61c5e9292f2 08-Oct-2009 Douglas Gregor <dgregor@apple.com> For instantiations of static data members of class templates, keep
track of the kind of specialization or instantiation. Also, check the
scope of the specialization and ensure that a specialization
declaration without an initializer is not a definition.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83533 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.spec/temp.expl.spec/p2.cpp
63e5e64a49ef936383ad93ea283b2b07f115e78c 08-Oct-2009 Douglas Gregor <dgregor@apple.com> Only perform an implicit instantiation of a function if its template
specialization kind is TSK_ImplicitInstantiation. Previously, we would
end up implicitly instantiating functions that had explicit
specialization declarations or explicit instantiation declarations
(with no corresponding definitions).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83511 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.spec/temp.expl.spec/p2.cpp
e3af0235ce6548e221e04c2ae5aeb0fb413ba736 08-Oct-2009 John McCall <rjmccall@apple.com> Refactoring around friend class templates. Better error message for friend enums.
Don't create a new declaration for friend classes if a declaration already exists.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83505 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/dcl.spec/dcl.type/dcl.type.elab/p3.cpp
1fef4e60e7e884803977a8376c172ea584f8a5d1 08-Oct-2009 Douglas Gregor <dgregor@apple.com> Type checking for specializations of member functions of class
templates. Previously, these weren't handled as specializations at
all. The AST for representing these as specializations is still a work
in progress.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83498 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.spec/temp.expl.spec/p2.cpp
0a4074768a6ecd81513f0db02bfb0e96ab3e56a0 07-Oct-2009 Douglas Gregor <dgregor@apple.com> Diagnose explicit instantiations and specializations that occur in class scope

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83473 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.spec/temp.expl.spec/p2.cpp
7974c3b7062f85bb7c0ada34526cdefe1d30f89b 07-Oct-2009 Douglas Gregor <dgregor@apple.com> Class template partial specializations can be declared anywhere that
its definition may be defined, including in a class.

Also, put in an assertion when trying to instantiate a class template
partial specialization of a member template, which is not yet
implemented.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83469 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.class.spec/p6.cpp
3d92d8c94e9447a6d903241e180590b4025c5927 07-Oct-2009 Douglas Gregor <dgregor@apple.com> More testing of explicit specializations

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83440 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.spec/temp.expl.spec/p2.cpp
d5cb8765ad3841ead8eaacb0360ac385f2f0e080 07-Oct-2009 Douglas Gregor <dgregor@apple.com> Refactor checking of the scope of explicit template specialization
declarations and explicit template instantiations, improving
diagnostics and making the code usable for function template
specializations (as well as class template specializations and partial
specializations).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83436 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.spec/temp.expl.spec/p1.cpp
emp/temp.spec/temp.expl.spec/p2.cpp
13d2d6cfd6a0032402c98b4fa237526c5b40e3fb 06-Oct-2009 Douglas Gregor <dgregor@apple.com> Test explicit specialization for all of the various cases where
explicit specializations can occur. Also, fix a minor recovery bug
where we should allow declarations coming from the parser to be NULL.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83416 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.spec/temp.expl.spec/p1.cpp
4a5c15f75f76b95e1c2ceb6fa2737dcadd5f4be1 01-Oct-2009 Douglas Gregor <dgregor@apple.com> Improve template argument deduction in the case where the parameter
type is a template-id (e.g., basic_ostream<CharT, Traits>) and the
argument type is a class that has a derived class matching the
parameter type. Previously, we were giving up on template argument
deduction too early.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83177 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.fct.spec/temp.deduct/temp.deduct.call/p3.cpp
d04b1be7d3015a307f93eea0b9ab0ecce612951e 28-Sep-2009 Douglas Gregor <dgregor@apple.com> Make sure that out-of-line function and variable definitions are not
pushed into scope. Fixes PR5056.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83003 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.class/temp.mem.func/pr5056.cpp
6102d98f3b806cc3f4a66cec27f5560b25ddd675 26-Sep-2009 Douglas Gregor <dgregor@apple.com> Fix name lookup for friend class templates to consider anything in a
scope *up to and including* the innermost namespace scope, rather than
just searching in the innermost namespace scope.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82849 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/basic.namespace/namespace.def/namespace.memdef/p3.cpp
d85bea2affdd59d83d1be7d24b97f436484c3625 26-Sep-2009 Douglas Gregor <dgregor@apple.com> Rework the Parse-Sema interaction for friends to better support friend
class templates. We now treat friend class templates much more like
normal class templates, except that they still get special name lookup
rules. Fixes PR5057 and eliminates a bunch of spurious diagnostics in
<iostream>.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82848 91177308-0d34-0410-b5e6-96231b3b80d8
lass/class.friend/p2.cpp
cl.dcl/dcl.spec/dcl.type/dcl.type.elab/p3.cpp
emp/temp.decls/temp.friend/p3.cpp
e06eafb7714fa20a5491f83921c2e4f9d3f85d5e 23-Sep-2009 Daniel Dunbar <daniel@zuster.org> Spell clang-cc correctly.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82582 91177308-0d34-0410-b5e6-96231b3b80d8
asic/basic.stc/basic.stc.dynamic/p2-nodef.cpp
83913e36c847052966d9ff60d760ea7231ed8b6b 17-Sep-2009 Anders Carlsson <andersca@mac.com> When creating function types, remove any top-level CVR qualifications in the function type argument types.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82093 91177308-0d34-0410-b5e6-96231b3b80d8
cl.decl/dcl.meaning/dcl.fct/p3.cpp
dd4a3b0065b9a7e7b00073df415a798886c090f3 17-Sep-2009 John McCall <rjmccall@apple.com> Improved representation and support for friend class templates. Angst about same.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82088 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.friend/p3.cpp
emp/temp.decls/temp.friend/p5.cpp
7adb10fa317cd7eacb0959f775e77353d4f24ad1 16-Sep-2009 Douglas Gregor <dgregor@apple.com> When implicitly declaring operators new, new[], delete, and delete[],
give them the appropriate exception specifications. This,
unfortunately, requires us to maintain and/or implicitly generate
handles to namespace "std" and the class "std::bad_alloc". However,
every other approach I've come up with was more hackish, and this
standard requirement itself is quite the hack.

Fixes PR4829.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81939 91177308-0d34-0410-b5e6-96231b3b80d8
asic/basic.stc/basic.stc.dynamic/p2-nodef.cpp
asic/basic.stc/basic.stc.dynamic/p2.cpp
9eea08ba72f8b1e7faf38e43376b9157fc4a2af2 15-Sep-2009 Douglas Gregor <dgregor@apple.com> Slightly improved template argument deduction for use in partial
ordering, along with another test case for partial ordering of partial
specializations.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81869 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.class.spec/temp.class.order/p2.cpp
05b23ea2119b4c411719bd6631e5d679ba5e7ef1 14-Sep-2009 John McCall <rjmccall@apple.com> Skeletal support for friend class templates.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81801 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.friend/p5.cpp
e73bb60de3c7c60453a86e097fc428d1cd367a42 14-Sep-2009 Douglas Gregor <dgregor@apple.com> Refactor MarkDeductedTemplateParameters into
MarkUsedTemplateParameters, which is able to mark template parameters
used within non-deduced contexts as well as deduced contexts. Use this
to finish the implementation of [temp.deduct.partial]p11.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81794 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.fct.spec/temp.deduct/temp.deduct.partial/p11.cpp
1282029f3d37f482bbba3c38ea9da17a78d11d40 14-Sep-2009 Douglas Gregor <dgregor@apple.com> Tighten up checking of non-dependent arguments as part of template
argument deduction. This fixes the new test case (since partial
ordering does not have a "verify the results of deduction" step), and
will allow failed template argument deductions to return more quickly
for, e.g., matching class template partial specializations.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81779 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.fct.spec/temp.deduct/temp.deduct.partial/p11.cpp
8a51491d936d8c50480f3c3ca6647be12a7ad51f 14-Sep-2009 Douglas Gregor <dgregor@apple.com> Implement partial ordering of function template specializations
(C++ [temp.func.order]).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81777 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.fct/temp.func.order/p4.cpp
emp/temp.decls/temp.fct/temp.func.order/p5.cpp
4719f4e86a84dec6f5a45771ae51d4ec72e4617a 12-Sep-2009 Douglas Gregor <dgregor@apple.com> When performing name lookup within a class template or class template
partial specialization, make sure we look into non-dependent base
classes (but not dependent base classes). Fixes PR4951.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81584 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.res/temp.dep/p3.cpp
6cc1518b9f15ca846b8c35518eeae9557935678d 11-Sep-2009 Douglas Gregor <dgregor@apple.com> Cleanup and test C++ default arguments. Improvements include:

- Diagnose attempts to add default arguments to templates (or member
functions of templates) after the initial declaration (DR217).
- Improve diagnostics when a default argument is redefined. Now, the
note will always point at the place where the default argument was
previously defined, rather than pointing to the most recent
declaration of the function.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81548 91177308-0d34-0410-b5e6-96231b3b80d8
cl.decl/dcl.meaning/dcl.fct.default/p10.cpp
cl.decl/dcl.meaning/dcl.fct.default/p2.cpp
cl.decl/dcl.meaning/dcl.fct.default/p3.cpp
cl.decl/dcl.meaning/dcl.fct.default/p4.cpp
cl.decl/dcl.meaning/dcl.fct.default/p5.cpp
cl.decl/dcl.meaning/dcl.fct.default/p6.cpp
cl.decl/dcl.meaning/dcl.fct.default/p7.cpp
cl.decl/dcl.meaning/dcl.fct.default/p8.cpp
9cc7807e1622c2f945b607bdd39dd283df5e7bb5 11-Sep-2009 John McCall <rjmccall@apple.com> Track a class template specialization's point of instantiation separately
from its location. Initialize appropriately.

When implicitly creating a declaration of a class template specialization
after encountering the first reference to it, use the pattern class's
location instead of the location of the first reference.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81515 91177308-0d34-0410-b5e6-96231b3b80d8
asic/basic.lookup/basic.lookup.elab/templateid.cpp
cl.dcl/dcl.spec/dcl.type/dcl.type.elab/p3.cpp
136a6988960ac3aeb96f298da7a1a182db7217cd 11-Sep-2009 John McCall <rjmccall@apple.com> When stringizing a NamedDecl for a diagnostic, treat the template
specialization types differently.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81512 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/dcl.spec/dcl.type/dcl.type.elab/p3.cpp
c4e7019d5c9034a2d84ee4695f8e98dc025ac131 11-Sep-2009 John McCall <rjmccall@apple.com> Support elaborated dependent types and diagnose tag mismatches.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81504 91177308-0d34-0410-b5e6-96231b3b80d8
asic/basic.lookup/basic.lookup.elab/templateid.cpp
cl.dcl/dcl.spec/dcl.type/dcl.type.elab/p3.cpp
6b2becfc434b0bdced8560802c4d0e03148c61b8 08-Sep-2009 John McCall <rjmccall@apple.com> Support templateids in friend declarations. Fixes bug 4859.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81233 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.friend/p1.cpp
f1bbbb49f06a7462476cd88166fccda5feb15cab 04-Sep-2009 John McCall <rjmccall@apple.com> Correctly handle elaborated template ids. Still not handled properly for friends.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80977 91177308-0d34-0410-b5e6-96231b3b80d8
asic/basic.lookup/basic.lookup.elab/templateid.cpp
82b9fb8e7a05066e690670d2eb386a624b04f684 02-Sep-2009 John McCall <rjmccall@apple.com> Borrow a friend class's previous declaration's access specifier regardless of
whether the current context is dependent.

Thanks to Anders for pointing this out.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80828 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.friend/p1.cpp
53489322f6574413d906f6a4c66033223e6b1e3f 02-Sep-2009 John McCall <rjmccall@apple.com> When adding a friend class declaration to the lookup tables, use the access specifier
of any previous declaration in case we replace it in a class's declaration table.
Fixes bug 4858. This sort of thing makes me reconsider putting friend declarations in
declaration lists.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80750 91177308-0d34-0410-b5e6-96231b3b80d8
lass/class.friend/p1.cpp
1a26c27eba32f8766c0eeec73fe43634cd814825 02-Sep-2009 John McCall <rjmccall@apple.com> Fix a little crasher in friend decls. Thanks again to Eli for finding this.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80748 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.friend/p1.cpp
d7eff68dbbbc6b3f8dfd44f6a833c2b320a96e9a 02-Sep-2009 John McCall <rjmccall@apple.com> Ensure that the tag decls of friend decls aren't added to the friending class's
decl list, and remove some workarounds that were due to this. Thanks to Eli for
pointing this out and providing the test case.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80745 91177308-0d34-0410-b5e6-96231b3b80d8
lass/class.friend/p1.cpp
ab88d97734f1260402a0c6a8f6b77bed7ed4e295 01-Sep-2009 John McCall <rjmccall@apple.com> Fix bug 4784 and allow friend declarations to properly extend
existing declaration chains.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80636 91177308-0d34-0410-b5e6-96231b3b80d8
lass/class.friend/p1-ambiguous.cpp
2a29c4b6ef710de49b1fd72902d6930033edae24 29-Aug-2009 John McCall <rjmccall@apple.com> Fix a last-minute typo and make the test not emit temporaries.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80419 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.friend/p1.cpp
f181d8a44f5837213eeaee6d71f584b1ab2849cd 29-Aug-2009 John McCall <rjmccall@apple.com> Ensure code generation for friend declarations in class templates.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80418 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.friend/p1.cpp
02cace78cf48cc26686bd5b07c78606abca13bcd 28-Aug-2009 John McCall <rjmccall@apple.com> Omnibus friend decl refactoring. Instead of cloning AST classes for friend
declarations of same, introduce a single AST class and add appropriate bits
(encoded in the namespace) for whether a decl is "real" or not. Much hackery
about previously-declared / not-previously-declared, but it's essentially
mandated by the standard that friends alter lookup, and this is at least
fairly non-intrusive.

Refactor the Sema methods specific to friends for cleaner flow and less nesting.

Incidentally solve a few bugs, but I remain confident that we can put them back.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80353 91177308-0d34-0410-b5e6-96231b3b80d8
lass/class.friend/p1.cpp
emp/temp.decls/temp.friend/p1.cpp
73b39cf02eaa346c6d7a76c32bf13759de7516db 28-Aug-2009 Anders Carlsson <andersca@mac.com> More work on using declarations.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80333 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/basic.namespace/namespace.udecl/p5-cxx0x.cpp
cl.dcl/basic.namespace/namespace.udecl/p6-cxx0x.cpp
cl.dcl/basic.namespace/namespace.udecl/p8-cxx0x.cpp
cf9f921268e67703d9cddcf9f2d6ac057c4c3cc8 28-Aug-2009 Anders Carlsson <andersca@mac.com> Many improvements to using declarations.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80332 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/basic.namespace/namespace.udecl/p3-cxx0x.cpp
cl.dcl/basic.namespace/namespace.udecl/p8-cxx0x.cpp
6dd38daf1495367db8fe9e9a5cacb7420cf08e27 27-Aug-2009 Douglas Gregor <dgregor@apple.com> When checking whether one declaration context encloses another, make sure to look at the primary contexts. Thanks to Eli for the test case

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80212 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.class/temp.mem.func/p1.cpp
bd4c4aebe6035e7a7125470cc9f0f92511230ee3 27-Aug-2009 Douglas Gregor <dgregor@apple.com> When a member reference expression includes a qualifier on the member
name, e.g.,

x->Base::f()

retain the qualifier (and its source range information) in a new
subclass of MemberExpr called CXXQualifiedMemberExpr. Provide
construction, transformation, profiling, printing, etc., for this new
expression type.

When a virtual function is called via a qualified name, don't emit a
virtual call. Instead, call that function directly. Mike, could you
add a CodeGen test for this, too?



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80167 91177308-0d34-0410-b5e6-96231b3b80d8
lass.derived/class.virtual/p12.cpp
dacd434c49658286c380c7b4c357d76d53cb4aa1 26-Aug-2009 Douglas Gregor <dgregor@apple.com> Improve diagnostics and recovery when the nested-name-specifier of a
qualified name does not actually refer into a class/class
template/class template partial specialization.

Improve printing of nested-name-specifiers to eliminate redudant
qualifiers. Also, make it possible to output a nested-name-specifier
through a DiagnosticBuilder, although there are relatively few places
that will use this leeway.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80056 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.class/temp.mem.func/p1.cpp
91cf4199cca311ea9c3b3a4e2b3984d508c9e5e3 25-Aug-2009 John McCall <rjmccall@apple.com> Modify an assert to capture the restriction on friend declarations more
accurately. Prevents the assert from triggering incorrectly when friending
functions first declared in extern "C" contexts. Fixes bug 4757.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80016 91177308-0d34-0410-b5e6-96231b3b80d8
lass/class.friend/p1.cpp
95190d00d54a493d9030908599feb073a7bb1d93 23-Aug-2009 Daniel Dunbar <daniel@zuster.org> Tests for C++ lex.trigraph, patch by Mats!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79841 91177308-0d34-0410-b5e6-96231b3b80d8
ex/lex.trigraph/p1.cpp
ex/lex.trigraph/p2.cpp
ex/lex.trigraph/p3.cpp
06c0f5b1bb1623a93a2bc4c345fb3be52a2b22a7 23-Aug-2009 Chris Lattner <sabre@nondot.org> Eli points out that we really must diagnose "void* > 0" as an extension.
Explicitly add it as an EXTENSION instead of an EXTWARN so that it only
comes out with -pedantic. Thanks Eli!




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79791 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.class.spec/temp.class.spec.mfunc/p1.cpp
d83d04041f64a2c89123d227fa8003b482391279 22-Aug-2009 Douglas Gregor <dgregor@apple.com> Implement delayed parsing for member function templates. Fixes PR4608.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79709 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.fct.spec/temp.deduct/temp.deduct.conv/p4.cpp
65ec1fda479688d143fe2403242cd9c730c800a1 22-Aug-2009 Douglas Gregor <dgregor@apple.com> Implement conversion function templates, along with the ability to use
template argument deduction from a conversion function (C++
[temp.deduct.conv]) with implicit conversions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79693 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.fct.spec/temp.deduct/temp.deduct.conv/p2.cpp
emp/temp.fct.spec/temp.deduct/temp.deduct.conv/p3.cpp
emp/temp.fct.spec/temp.deduct/temp.deduct.conv/p4.cpp
17e32f30e2d1eaf6639d3d4e2196a8d7c709fbac 22-Aug-2009 Douglas Gregor <dgregor@apple.com> Refactor instantiation of destructors to use the common CXXMethodDecl
code, fixing a problem where instantiations of out-of-line destructor
definitions would had the wrong lexical context.

Introduce tests for out-of-line definitions of the constructors,
destructors, and conversion functions of a class template partial
specialization.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79682 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.class.spec/temp.class.spec.mfunc/p1.cpp
1cbc6b044fac411ed97c2c97b6873439ac048c91 22-Aug-2009 Douglas Gregor <dgregor@apple.com> Add test for out-of-line definition of a conversion function

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79679 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.class/temp.mem.func/p1.cpp
ac373c4ca596a144d906570f284d46d702e10719 22-Aug-2009 Douglas Gregor <dgregor@apple.com> Fix parsing for out-of-line definitions of constructors and
destructors of class templates.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79678 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.class/temp.mem.func/p1.cpp
e29ba20148e9b7835ad463b39cd4ee9223eafbbf 20-Aug-2009 John McCall <rjmccall@apple.com> Basic nested-template implementation.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79504 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.mem/p1.cpp
fd810b1386ed29b250e7d522ea826a65c815e49d 14-Aug-2009 John McCall <rjmccall@apple.com> Support friend declarations in templates and test that argdep lookup
still works.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@78979 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.friend/p1.cpp
3f9a8a60614b763785d54ad08821745d03a4af70 11-Aug-2009 John McCall <rjmccall@apple.com> Argument-dependent lookup for friend declarations. Add a new decl type,
FriendFunctionDecl, and create instances as appropriate.

The design of FriendFunctionDecl is still somewhat up in the air; you can
befriend arbitrary types of functions --- methods, constructors, etc. ---
and it's not clear that this representation captures that very well.
We'll have a better picture when we start consuming this data in access
control.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@78653 91177308-0d34-0410-b5e6-96231b3b80d8
asic/basic.lookup/basic.lookup.argdep/p4.cpp
7f27d92006936b16a29ca0a5c442476b4f585b21 06-Aug-2009 John McCall <rjmccall@apple.com> Permit a class to friend its members in C++0x, without restriction.
Permit a class to friend its class members in C++ 98, as long as extensions
are enabled (and even when they aren't, only give an extwarn about it).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@78332 91177308-0d34-0410-b5e6-96231b3b80d8
lass/class.friend/p1.cpp
4a959d8788179d654df6b213b08d2b064989211d 06-Aug-2009 Douglas Gregor <dgregor@apple.com> When we encounter a dependent type that was parsed before we know that
we were going to enter into the scope of a class template or class
template partial specialization, rebuild that type so that it can
refer to members of the current instantiation, as in code like

template<typename T>
struct X {
typedef T* pointer;
pointer data();
};

template<typename T>
typename X<T>::pointer X<T>::data() { ... }

Without rebuilding the return type of this out-of-line definition, the
canonical return type of the out-of-line definition (a TypenameType)
will not match the canonical return type of the declaration (the
canonical type of T*).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@78316 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.class/temp.mem.func/p1-retmem.cpp
67d1a67f3db2f1aa69083c5c94164d6e0ee05b32 06-Aug-2009 John McCall <rjmccall@apple.com> First pass at friend semantics.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@78274 91177308-0d34-0410-b5e6-96231b3b80d8
asic/basic.lookup/basic.lookup.unqual/p3.cpp
lass/class.friend/p1.cpp
lass/class.friend/p2.cpp
lass/class.friend/p6.cpp
213a60edb7d67c2b324e3e9b9349b681f97baf10 06-Aug-2009 John McCall <rjmccall@apple.com> AlisdairM pointed out that this will likely be relaxed in C++0x, so let's
make a note of it in the test case.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@78266 91177308-0d34-0410-b5e6-96231b3b80d8
lass/class.nest/p1.cpp
e9472787be0202e80931d51f108e46dc677cf50c 06-Aug-2009 John McCall <rjmccall@apple.com> Add a test for invalid uses of non-static members from nested classes, just
because I was thinking about it.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@78262 91177308-0d34-0410-b5e6-96231b3b80d8
lass/class.nest/p1.cpp
211c278e536b9f5bf468a99dc24449ad734466fe 31-Jul-2009 Douglas Gregor <dgregor@apple.com> Make the recanonicalization-for-an-out-of-line-definition test case a bit trickier

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77707 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.class/temp.mem.func/p1-retmem.cpp
b88e888404ad0a2bdd9bfae457e8530bb38a87c5 30-Jul-2009 Douglas Gregor <dgregor@apple.com> Support out-of-line definitions of the members of class template
partial specializations.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77606 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.class.spec/temp.class.spec.mfunc/p1-neg.cpp
emp/temp.decls/temp.class.spec/temp.class.spec.mfunc/p1.cpp
828e226ab7ed08b3eb766549e9d3306432137460 29-Jul-2009 Douglas Gregor <dgregor@apple.com> Use the new statement/expression profiling code to unique dependent
template arguments, as in template specialization types. This permits
matching out-of-line definitions of members for class templates that
involve non-type template parameters.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77462 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.fct/temp.over.link/p6.cpp
8bda2e66fa8050a6b3eef745628873eef4b683d8 28-Jul-2009 Douglas Gregor <dgregor@apple.com> Add a template test that requires canonical expression comparison

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77325 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.fct/temp.over.link/p6.cpp
bc0a2226c7fcd18b29b6846049e2cfcb872d3593 27-Jul-2009 Owen Anderson <resistor@mac.com> Update for LLVM API change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77249 91177308-0d34-0410-b5e6-96231b3b80d8
lass/class.local/p4.cpp
ver/over.over/p2.cpp
emp/temp.decls/temp.class/temp.mem.class/p1.cpp
emp/temp.decls/temp.class/temp.mem.func/p1-retmem.cpp
emp/temp.decls/temp.class/temp.mem.func/p1inst.cpp
emp/temp.decls/temp.class/temp.static/p1-inst.cpp
emp/temp.decls/temp.class/temp.static/p1.cpp
emp/temp.fct.spec/temp.arg.explicit/p3.cpp
emp/temp.fct.spec/temp.deduct/temp.deduct.funcaddr/p1.cpp
8bf0ccd4c7e23a329f150323e2f9b474ff15c66c 25-Jul-2009 Daniel Dunbar <daniel@zuster.org> Make having no RUN line a failure.

Doug, please look at decltype-crash and instantiate-function-1.mm, I'm not sure
if they are actually testing the right thing / anything.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77070 91177308-0d34-0410-b5e6-96231b3b80d8
lass/class.nested.type/p1.cpp
emp/temp.param/p1.cpp
13591ed054d1b2d6d392151ba05cbc883e640648 25-Jul-2009 John McCall <rjmccall@apple.com> Semantic checking for main().

Fix some invalid main() methods in the test suite that were nicely
exposed by the new checks.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77047 91177308-0d34-0410-b5e6-96231b3b80d8
asic/basic.start/basic.start.main/p2a.cpp
asic/basic.start/basic.start.main/p2b.cpp
asic/basic.start/basic.start.main/p2c.cpp
asic/basic.start/basic.start.main/p2d.cpp
asic/basic.start/basic.start.main/p2e.cpp
asic/basic.start/basic.start.main/p2f.cpp
asic/basic.start/basic.start.main/p2g.cpp
7caa6825f42a0f7e97d6fc06233133c42b218e46 24-Jul-2009 Douglas Gregor <dgregor@apple.com> Template instantiation for static data members that are defined out-of-line.

Note that this also fixes a bug that affects non-template code, where we
were not treating out-of-line static data members are "file-scope" variables,
and therefore not checking their initializers.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77002 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.class/temp.static/p1-inst.cpp
emp/temp.decls/temp.class/temp.static/p1.cpp
7cdbc5832084f45721693dfb1d93284c3e08efee 23-Jul-2009 Douglas Gregor <dgregor@apple.com> Implement support for out-of-line definitions of the class members of class
templates, e.g.,

template<typename T>
struct Outer {
struct Inner;
};

template<typename T>
struct Outer<T>::Inner {
// ...
};

Implementing this feature required some extensions to ActOnTag, which
now takes a set of template parameter lists, and is the precursor to
removing the ActOnClassTemplate function from the parser Action
interface. The reason for this approach is simple: the parser cannot
tell the difference between a class template definition and the
definition of a member of a class template; both have template
parameter lists, and semantic analysis determines what that template
parameter list means.

There is still some cleanup to do with ActOnTag and
ActOnClassTemplate. This commit provides the basic functionality we
need, however.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76820 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.class/temp.mem.class/p1.cpp
3ef84e157574b52ff8cbf6f49bf92047eb3f2f86 22-Jul-2009 Mike Stump <mrs@apple.com> Prep for new warning.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76772 91177308-0d34-0410-b5e6-96231b3b80d8
lass/class.union/p1.cpp
1f2023ab8b35e0f665eb6c0f11dd6d9b9bca12b8 22-Jul-2009 Douglas Gregor <dgregor@apple.com> "This patch implements the restrictions on union members detailed in
[class.union]p1", from John McCall!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76766 91177308-0d34-0410-b5e6-96231b3b80d8
lass/class.union/p1.cpp
dfe3f2d8ba49f03d01f42570e640d9a6755e6c08 22-Jul-2009 Douglas Gregor <dgregor@apple.com> Implement parsing and semantic analysis for out-of-line definitions of static
data members of class templates. We don't instantiate the definitions yet,
however.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76756 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.class/temp.static/p1.cpp
5c7e281d368601858f9f5e5fe11734eea10b9523 22-Jul-2009 Douglas Gregor <dgregor@apple.com> Test template instantiation for member functions of class templates defined
out of line.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76740 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.class/temp.mem.func/p1inst.cpp
7551c183e8d788b5254e9c6f8bd8d719cea47da8 22-Jul-2009 Douglas Gregor <dgregor@apple.com> Complain if we're entering the context of a dependent nested-name-specifier but
cannot match that nested-name-specifier to a class template or class template
partial specialization.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76704 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.class/temp.mem.func/p1.cpp
f59a56e180bf54528d7d1d5afa68fcc13300965a 22-Jul-2009 Douglas Gregor <dgregor@apple.com> Basic parsing and semantic analysis for out-of-line definitions of the
member functions of class templates, e.g.,

template<typename T>
struct X {
void f(T);
};

template<typename T> X<T>::f(T) { /* ... */ }



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76692 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.class/temp.mem.func/p1-retmem.cpp
emp/temp.decls/temp.class/temp.mem.func/p1.cpp
8e8221070954da06c52b27babf40561ea874c75e 22-Jul-2009 Mike Stump <mrs@apple.com> Revert this, we have a better way to do this.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76687 91177308-0d34-0410-b5e6-96231b3b80d8
lass/class.local/p3.cpp
f18de03d2193d79755921e428af62b0a3aef2312 22-Jul-2009 Mike Stump <mrs@apple.com> Revert this, we have a better way to handle this.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76685 91177308-0d34-0410-b5e6-96231b3b80d8
lass/class.local/p1.cpp
cb077fc8e0d440f024bbdf57983b84b6d658b60b 21-Jul-2009 Mike Stump <mrs@apple.com> Prep for new warning.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76640 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.fct/temp.over.link/p4-neg.cpp
f0a6a0c29fb733b934930374554c84a83db5a790 21-Jul-2009 Mike Stump <mrs@apple.com> Prep for new warning.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76628 91177308-0d34-0410-b5e6-96231b3b80d8
lass/class.local/p3.cpp
8d36222f509f89ac0f0da3b221b8cabf20ee89a2 21-Jul-2009 Mike Stump <mrs@apple.com> Prep for new warning.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76627 91177308-0d34-0410-b5e6-96231b3b80d8
lass/class.local/p1.cpp
5dfb823b43637d172e91a778e91d23a510af670b 11-Jul-2009 Daniel Dunbar <daniel@zuster.org> Fix test case to match intent.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@75381 91177308-0d34-0410-b5e6-96231b3b80d8
ver/over.over/p1.cpp
a0f71de52e827928eb9b84a40e9c8f69469a32ad 11-Jul-2009 Anders Carlsson <andersca@mac.com> Add another test.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@75324 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p3.cpp
6a75cd9c1d54625fca7b5477ab9545bcdbd85ea4 11-Jul-2009 Anders Carlsson <andersca@mac.com> Implement more of C++0x 'auto'. A variable with an auto type specifier must have an initializer. Also, move some tests around to match the C++0x draft better.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@75322 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p2.cpp
cl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p5.cpp
0d5dc8e23133d0b8d8d8e6d81834f4d11923dc82 09-Jul-2009 Douglas Gregor <dgregor@apple.com> Another little test for C++ [over.over]

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@75151 91177308-0d34-0410-b5e6-96231b3b80d8
ver/over.over/p2.cpp
72e771f12a97700e578b28f953622a6b6916bef1 09-Jul-2009 Douglas Gregor <dgregor@apple.com> Add test for C++ [over.over.]p1, the contexts in which one can take the address of an overloaded function.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@75146 91177308-0d34-0410-b5e6-96231b3b80d8
ver/over.over/p1.cpp
9b31df4acdeeb61bb084a03fc37bc5bd570a659e 09-Jul-2009 Anders Carlsson <andersca@mac.com> Store the isAddressOfOperand in the UnresolvedDeclRefExpr, so that we can pass it when instantiating the expr. Fixes another member pointer bug.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@75075 91177308-0d34-0410-b5e6-96231b3b80d8
cl.decl/dcl.meaning/dcl.mptr/p3.cpp
00aeb52314ec0b1902bb15aef9c62259296fbc29 09-Jul-2009 Douglas Gregor <dgregor@apple.com> Implement the simple form of overload resolution used when taking the
address of an overloaded function (which may involve both functions
and function templates).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@75069 91177308-0d34-0410-b5e6-96231b3b80d8
ver/over.over/p4.cpp
f9e48bdea6e56404deb0776bf2d0eddedb77dce3 08-Jul-2009 Anders Carlsson <andersca@mac.com> It's not allowed to form member pointers to members that have reference type. Add a test for this and the rest of [dcl.mptr]p3.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@75054 91177308-0d34-0410-b5e6-96231b3b80d8
cl.decl/dcl.meaning/dcl.mptr/p3.cpp
83314aa1cf61ed2458a8a20c83b2d4708192d5dc 08-Jul-2009 Douglas Gregor <dgregor@apple.com> Implement template argument deduction when taking the address of a
function template. Most of the change here is in factoring out the
common bits used for template argument deduction from a function call
and when taking the address of a function template.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@75044 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.fct.spec/temp.deduct/temp.deduct.funcaddr/p1.cpp
daa439a6c47d3299157b94a496bf22389bbc77a3 08-Jul-2009 Douglas Gregor <dgregor@apple.com> Fix a corner case with argument-dependent lookup and overloaded function sets.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74999 91177308-0d34-0410-b5e6-96231b3b80d8
asic/basic.lookup/basic.lookup.argdep/p2-template-id.cpp
69be8d60ded8bbfbd30facf0590c97920a074f46 08-Jul-2009 Douglas Gregor <dgregor@apple.com> Improve argument-dependent lookup to find associated classes and
namespaces based on the template arguments of a class template
specialization type.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74993 91177308-0d34-0410-b5e6-96231b3b80d8
asic/basic.lookup/basic.lookup.argdep/p2-template-id.cpp
asic/basic.lookup/basic.lookup.argdep/p2.cpp
3e15cc318e9cd577eda56c0294f32535738d8630 08-Jul-2009 Douglas Gregor <dgregor@apple.com> Overload resolution prefers non-templates to templates

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74971 91177308-0d34-0410-b5e6-96231b3b80d8
ver/over.match/over.match.best/p1.cpp
de0cb8b6c15c756e14b0716bebd40f4ce48ee717 08-Jul-2009 Douglas Gregor <dgregor@apple.com> Improve template argument deduction from a call. In particular,
implement C++ [temp.deduct.call]p3b3, which allows a template-id
parameter to match a derived class of the argument, while deducing
template arguments.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74965 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.fct.spec/temp.deduct/temp.deduct.call/p3.cpp
41e8c21eb41fca41e2e065e75f01433427858c19 02-Jul-2009 Ted Kremenek <kremenek@apple.com> Fix RUN line so this test doesn't hang.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74719 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.fct.spec/temp.deduct/sfinae-1.cpp
cca9e9674a5e50a283185d8e9d8a5c3414eb008e 02-Jul-2009 Douglas Gregor <dgregor@apple.com> Keep track of more information within the template instantiation stack, e.g.,
by distinguishing between substitution that occurs for template
argument deduction vs. explicitly-specifiad template arguments. This
is used both to improve diagnostics and to make sure we only provide
SFINAE in those cases where SFINAE should apply.

In addition, deal with the sticky issue where SFINAE only considers
substitution of template arguments into the *type* of a function
template; we need to issue hard errors beyond this point, as
test/SemaTemplate/operator-template.cpp illustrates.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74651 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.fct.spec/temp.deduct/sfinae-1.cpp
16134c62ef3d146e0dd0c76aafb906ff12c0a15d 01-Jul-2009 Douglas Gregor <dgregor@apple.com> Cope with explicitly-specified function template arguments when there
are fewer template arguments than there are template parameters for
that function.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74578 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.fct.spec/temp.arg.explicit/p3.cpp
6db8ed4498b83fe9336e3855a4ba1a298b04ee00 01-Jul-2009 Douglas Gregor <dgregor@apple.com> When explicit template arguments are provided for a function call,
substitute those template arguments into the function parameter types
prior to template argument deduction. There's still a bit of work to
do to make this work properly when only some of the template arguments
are specified.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74576 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.fct.spec/temp.arg.explicit/p1.cpp
edce4dd44732dfad69f28822dddcf2b8e92b4483 01-Jul-2009 Douglas Gregor <dgregor@apple.com> Preliminary parsing and ASTs for template-ids that refer to function
templates, such as make<int&>. These template-ids are only barely
functional for function calls; much more to come.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74563 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.fct.spec/temp.arg.explicit/p1.cpp
b33fe2ff12676bff9db595fdf77e29014d7ba397 30-Jun-2009 Douglas Gregor <dgregor@apple.com> When recursively instantiating function templates, keep track of the
instantiation stack so that we provide a full instantiation
backtrace. Previously, we performed all of the instantiations implied
by the recursion, but each looked like a "top-level" instantiation.

The included test case tests the previous fix for the instantiation of
DeclRefExprs. Note that the "instantiated from" diagnostics still
don't tell us which template arguments we're instantiating with.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74540 91177308-0d34-0410-b5e6-96231b3b80d8
asic/basic.def.odr/p2-typeid.cpp
508f1c889b9833903ea394034fe0246d3a57a32d 27-Jun-2009 Douglas Gregor <dgregor@apple.com> During template argument deduction from a function call, allow
deduction from pointer and pointer-to-member types to work even in the
presence of a qualification conversion (C++ [temp.deduct.type]p3
bullet 2).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74354 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.fct.spec/temp.deduct/temp.deduct.call/p3.cpp
baf45d31f18e6d5b3d2a33695c2af6e6cbc4ee29 27-Jun-2009 Anders Carlsson <andersca@mac.com> More auto work.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74339 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p2.cpp
714d35b451b9250bb53f5c27327bc3348a6ba54b 26-Jun-2009 Anders Carlsson <andersca@mac.com> Fix test.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74335 91177308-0d34-0410-b5e6-96231b3b80d8
cl.decl/dcl.meaning/dcl.array/p1-cxx0x.cpp
8a5cb1196ee8491570160e36c216631df3a9e95c 26-Jun-2009 Douglas Gregor <dgregor@apple.com> A little template argument deduction test uncovered an "oops". As part
of template instantiation, we were dropping cv-qualifiers on the
instantiated type in a few places. This change reshuffles the
type-instantiation code a little bit so that there's a single place
where we add qualifiers to the instantiated type, so that we won't end
up with this same bug in the future.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74331 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.fct.spec/temp.deduct/temp.deduct.call/p3.cpp
f670c8cfa58b4c224eb8fb566130dc47844dd3de 26-Jun-2009 Douglas Gregor <dgregor@apple.com> Template argument deduction is no longer responsible for checking
non-dependent parameter types. Instead, class template partial
specializations perform a final check of all of the instantiated
arguments. This model is cleaner, and works better for function
templates where the "final check" occurs during overload resolution.

Also, cope with cv-qualifiers when the parameter type was originally a
reference type, so that the deduced argument can be more qualified
than the transformed argument.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74323 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.fct.spec/temp.deduct/temp.deduct.call/basic.cpp
e7cf07d8df83e083505c7105c50b2797493008a6 26-Jun-2009 Anders Carlsson <andersca@mac.com> Can't have arrays of auto.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74314 91177308-0d34-0410-b5e6-96231b3b80d8
cl.decl/dcl.meaning/dcl.array/p1-cxx0x.cpp
e2bb224dee15d07bc9843acd4f3ded8eb0f835ed 26-Jun-2009 Anders Carlsson <andersca@mac.com> An auto variable can't appear in its own initializer.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74312 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p2.cpp
500d331eade2f5070b66ba51d777224f9fda6e1d 26-Jun-2009 Douglas Gregor <dgregor@apple.com> Improve template argument deduction for reference parameters when
deducing template arguments from a function call. Plus, add a bunch of
tests.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74301 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.fct.spec/temp.deduct/temp.deduct.call/p2.cpp
emp/temp.fct.spec/temp.deduct/temp.deduct.call/p3.cpp
e53060fa78ad7e98352049f72787bdb7543e2a48 26-Jun-2009 Douglas Gregor <dgregor@apple.com> Improved semantic analysis and AST respresentation for function
templates.

For example, this now type-checks (but does not instantiate the body
of deref<int>):

template<typename T> T& deref(T* t) { return *t; }

void test(int *ip) {
int &ir = deref(ip);
}

Specific changes/additions:
* Template argument deduction from a call to a function template.
* Instantiation of a function template specializations (just the
declarations) from the template arguments deduced from a call.
* FunctionTemplateDecls are stored directly in declaration contexts
and found via name lookup (all forms), rather than finding the
FunctionDecl and then realizing it is a template. This is
responsible for most of the churn, since some of the core
declaration matching and lookup code assumes that all functions are
FunctionDecls.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74213 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.fct.spec/temp.deduct/temp.deduct.call/basic.cpp
60a9a2a404a4cf259d39133383e922aa00ca9043 24-Jun-2009 Anders Carlsson <andersca@mac.com> C++ decltype support (N2343)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74118 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/dcl.spec/dcl.type/dcl.type.simple/p4-cxx0x.cpp
34d1dc9f0ca8f5b0528a8cd29f1addfe096361b8 24-Jun-2009 Douglas Gregor <dgregor@apple.com> Implement matching of function templates, so that one can declare overloaded function templates. C++ [temp.over.link] paragraphs 4-8.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74079 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.decls/temp.fct/temp.over.link/p4-neg.cpp
emp/temp.decls/temp.fct/temp.over.link/p4.cpp
9ca97ba45c17926c6f8fd68977470023da78866a 24-Jun-2009 Anders Carlsson <andersca@mac.com> Add test for [class.local]p2.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74051 91177308-0d34-0410-b5e6-96231b3b80d8
lass/class.local/p2.cpp
3aa518b5ff0aaf4f095bcfb4bf8f2299250ca188 24-Jun-2009 Anders Carlsson <andersca@mac.com> Add test for [class.nested.type]p1

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74033 91177308-0d34-0410-b5e6-96231b3b80d8
lass/class.nested.type/p1.cpp
e98da2e7af16056a53db327b520d4b53b4be5e7a 24-Jun-2009 Anders Carlsson <andersca@mac.com> Support for [class.local]p4.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74030 91177308-0d34-0410-b5e6-96231b3b80d8
lass/class.local/p4.cpp
e41590d2504d73453d58f22e9176088990555cc1 24-Jun-2009 Anders Carlsson <andersca@mac.com> [class.local] p1 and p3. Also, add back the xcodeproj file.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74027 91177308-0d34-0410-b5e6-96231b3b80d8
lass/class.local/p1.cpp
lass/class.local/p3.cpp
e67068c5f90d7cbc39f970e951d7e8622c485838 23-Jun-2009 Douglas Gregor <dgregor@apple.com> Add a test illustrating our current inability to properly cope with the point of instantation of a member function of a class template specialization

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73956 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.res/temp.dep.res/temp.point/p1.cpp
33a3907db98dd79728f8f887f0468d3d98c49fcf 23-Jun-2009 Douglas Gregor <dgregor@apple.com> New test for when the subexpressions within a typeid are potentially evaluated. We seem to be the only ones to get this right.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73955 91177308-0d34-0410-b5e6-96231b3b80d8
asic/basic.def.odr/p2-typeid.cpp
0ffd9ffb633ca4886c7db4dd12dc36bdad3d797c 18-Jun-2009 Argyrios Kyrtzidis <akyrtzi@gmail.com> Implement correct name lookup inside an initializer of a C++ class static data member.

Fixes "test/CXX/basic/basic.lookup/basic.lookup.unqual/p13.cpp" test case.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73652 91177308-0d34-0410-b5e6-96231b3b80d8
asic/basic.lookup/basic.lookup.unqual/p13.cpp
b280638d20eb16216be38987ecd7af72c73053b4 15-Jun-2009 Daniel Dunbar <daniel@zuster.org> More [basic.lookup.unqual] tests.
- p13 and p14 are important failures.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73392 91177308-0d34-0410-b5e6-96231b3b80d8
asic/basic.lookup/basic.lookup.unqual/p11.cpp
asic/basic.lookup/basic.lookup.unqual/p12.cpp
asic/basic.lookup/basic.lookup.unqual/p13.cpp
asic/basic.lookup/basic.lookup.unqual/p14.cpp
asic/basic.lookup/basic.lookup.unqual/p15.cpp
cbeedfaf2d8779bfa9a91c0f923c60b8a12627f4 15-Jun-2009 Daniel Dunbar <daniel@zuster.org> Test for [basic.lookup.unqual]p3
- Failing, at least in part, because lookup in parser is finding a friend
function where it shouldn't.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73388 91177308-0d34-0410-b5e6-96231b3b80d8
asic/basic.lookup/basic.lookup.unqual/p3.cpp
247baca66ca998de9c415c19019e199f4895e81c 13-Jun-2009 Douglas Gregor <dgregor@apple.com> Move a bunch of tests into temp.param, and write a few tests for paragraphs that hadn't been touched before

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73288 91177308-0d34-0410-b5e6-96231b3b80d8
emp/temp.param/p1.cpp
emp/temp.param/p10.cpp
emp/temp.param/p11.cpp
emp/temp.param/p12.cpp
emp/temp.param/p13.cpp
emp/temp.param/p14.cpp
emp/temp.param/p15-cxx0x.cpp
emp/temp.param/p15.cpp
emp/temp.param/p2.cpp
emp/temp.param/p3.cpp
emp/temp.param/p4.cpp
emp/temp.param/p7.cpp
emp/temp.param/p8.cpp
cb8845f3e358b8583c41ba9bdb9165670900a8e2 13-Jun-2009 Daniel Dunbar <daniel@zuster.org> Add some random C++ standard tests.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73287 91177308-0d34-0410-b5e6-96231b3b80d8
cl.dcl/dcl.spec/dcl.fct.spec/p3.cpp
cl.dcl/dcl.spec/dcl.fct.spec/p4.cpp
cl.dcl/dcl.spec/dcl.fct.spec/p6.cpp
cl.dcl/dcl.spec/dcl.stc/p10.cpp
cl.dcl/dcl.spec/dcl.stc/p9.cpp
cl.dcl/dcl.spec/dcl.typedef/p3.cpp
cl.dcl/dcl.spec/dcl.typedef/p4.cpp