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

Change-Id: I8c9133b0f8f776dc915f270b60f94962e771bc83
cl.init/dcl.init.list/basic.cpp
cl.init/dcl.init.list/p3-0x.cpp
cl.init/dcl.init.list/p7-0x-fixits.cpp
cl.init/dcl.init.list/p7-0x.cpp
cl.init/dcl.init.list/p7-cxx11-nowarn.cpp
cl.meaning/dcl.fct/p6-0x.cpp
cl.meaning/dcl.fct/p6.cpp
cl.meaning/p1-0x.cpp
651f13cea278ec967336033dd032faef0e9fc2ec 24-Apr-2014 Stephen Hines <srhines@google.com> Updated to Clang 3.5a.

Change-Id: I8127eb568f674c2e72635b639a3295381fe8af82
cl.init/dcl.init.list/p7-0x.cpp
cl.init/dcl.init.list/p7-cxx11-nowarn.cpp
cl.meaning/dcl.fct/p8.cpp
cl.meaning/dcl.mptr/p3.cpp
cl.meaning/dcl.ref/p6-0x.cpp
cl.meaning/p1-0x.cpp
cl.meaning/p1.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
cl.meaning/dcl.fct.default/p10.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.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
cl.meaning/dcl.array/p3.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.meaning/dcl.fct/p2-cxx0x.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
cl.meaning/dcl.array/p3.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.init/dcl.init.list/p3-0x.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.init/dcl.init.ref/p5.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
cl.fct.def/dcl.fct.def.default/p2.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.init/dcl.init.aggr/p1-0x.cpp
cl.init/dcl.init.aggr/p7.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.init/dcl.init.ref/p5-0x.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.init/dcl.init.ref/p5-0x.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.init/dcl.init.list/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.meaning/dcl.fct.default/p3.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.init/dcl.init.list/p3-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.meaning/dcl.fct/p8.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.init/dcl.init.ref/p5-examples.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
cl.fct.def/dcl.fct.def.default/p1.cpp
cl.meaning/dcl.fct/dcl.fct.def.default/p2.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
cl.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.fct.def/dcl.fct.def.default/p1.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
cl.init/dcl.init.ref/basic.cpp
cl.init/dcl.init.ref/p1.cpp
cl.init/dcl.init.string/p1.cpp
cl.meaning/dcl.fct.default/p2.cpp
cl.meaning/dcl.fct/p14.cpp
cl.meaning/dcl.ref/p6-0x.cpp
cl.name/p1.cpp
4-0x.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.meaning/dcl.fct.default/p3.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.init/p7.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.init/dcl.init.aggr/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.meaning/p1.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.fct.def/dcl.fct.def.default/p2.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.meaning/dcl.fct/dcl.fct.def.default/p1.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.init/dcl.init.list/p3-0x.cpp
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.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.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.init/dcl.init.ref/p5-cxx03-extra-copy.cpp
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.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.meaning/dcl.fct/p9-0x.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.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
cl.fct.def/dcl.fct.def.default/p2.cpp
cl.init/dcl.init.aggr/p1-0x.cpp
cl.meaning/dcl.fct/dcl.fct.def.default/p2.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.meaning/dcl.fct/p9-0x.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.init/dcl.init.list/basic.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.init/dcl.init.aggr/p1-0x.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.meaning/p1.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
cl.meaning/p1.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.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.name/p1.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.fct.def/dcl.fct.def.default/p2.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.init/dcl.init.aggr/p1-0x.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
cl.meaning/dcl.fct/p6-0x.cpp
cl.meaning/dcl.fct/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.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.init/dcl.init.list/p7-0x.cpp
cl.init/dcl.init.list/p7-cxx11-nowarn.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.init/dcl.init.list/p7-0x.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.init/dcl.init.string/p1.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.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.fct.def/dcl.fct.def.default/p2.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
cl.init/dcl.init.ref/p5-cxx03-extra-copy.cpp
cl.meaning/dcl.ref/p5.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.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.meaning/p1-0x.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
cl.init/dcl.init.aggr/p1-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.init/dcl.init.aggr/p1-0x.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.init/dcl.init.list/p7-0x-fixits.cpp
cl.init/dcl.init.ref/p5-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
cl.init/dcl.init.aggr/p1-0x.cpp
cl.init/dcl.init.list/p7-0x.cpp
cl.init/dcl.init.ref/p1.cpp
cl.init/dcl.init.ref/p5-0x.cpp
cl.init/dcl.init.ref/p5-cxx0x-no-extra-copy.cpp
cl.init/p14-0x.cpp
cl.meaning/dcl.array/p1-cxx0x.cpp
cl.meaning/dcl.fct/dcl.fct.def.default/p2.cpp
cl.meaning/dcl.fct/p13.cpp
cl.meaning/dcl.fct/p14.cpp
cl.meaning/dcl.fct/p2-cxx0x.cpp
cl.meaning/dcl.fct/p6-0x.cpp
cl.meaning/dcl.fct/p8-0x.cpp
cl.meaning/dcl.fct/p9-0x.cpp
cl.meaning/dcl.ref/p6-0x.cpp
4-0x.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.init/dcl.init.string/p1.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.init/dcl.init.ref/p5-0x.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.meaning/dcl.fct/dcl.fct.def.default/p2.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.init/dcl.init.aggr/p4.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.init/dcl.init.aggr/p1-0x.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.meaning/dcl.fct/dcl.fct.def.default/p2.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.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.init/p14-0x.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.init/dcl.init.list/p7-0x.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.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.init/dcl.init.list/p7-0x.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.meaning/dcl.fct.default/p10.cpp
cl.meaning/dcl.fct.default/p4.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.init/dcl.init.list/p7-0x-fixits.cpp
cl.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.init/dcl.init.aggr/p1-0x.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.init/dcl.init.aggr/p1-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
cl.init/dcl.init.aggr/p1-0x.cpp
cl.init/p14-0x.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
cl.init/p6.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.init/dcl.init.string/p2.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
cl.meaning/dcl.fct/p13.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.meaning/dcl.fct/p2-cxx0x.cpp
cl.meaning/dcl.fct/p8-0x.cpp
cl.meaning/dcl.fct/p9-0x.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.meaning/dcl.array/p1-cxx0x.cpp
cl.meaning/dcl.fct/p2-cxx0x.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.meaning/dcl.fct/p6-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.meaning/dcl.fct/p6-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
4-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.init/dcl.init.ref/p5-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.init/dcl.init.ref/p5-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.init/dcl.init.ref/p5-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.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.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.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.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.init/dcl.init.ref/p5-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.init/dcl.init.ref/p5-0x.cpp
cl.meaning/dcl.ref/p6-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.meaning/dcl.fct/p13.cpp
cl.meaning/dcl.fct/p14.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.meaning/dcl.array/p1.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.meaning/dcl.fct/p13.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.meaning/dcl.fct/p13.cpp
cl.meaning/dcl.fct/p14.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.init/dcl.init.ref/p5-examples.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.init/dcl.init.ref/p5-cxx03-extra-copy.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
cl.meaning/dcl.fct/p6.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.init/dcl.init.ref/p5-var.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.meaning/dcl.fct/p8.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.init/dcl.init.ref/p5-examples.cpp
cl.init/dcl.init.ref/p5-var.cpp
cl.init/p6.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.init/dcl.init.ref/p5-examples.cpp
cl.init/dcl.init.ref/p5-var.cpp
cl.init/p6.cpp
cl.meaning/dcl.array/p1.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.init/p5.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.init/dcl.init.ref/p5-cxx03-extra-copy.cpp
cl.init/dcl.init.ref/p5-cxx0x-no-extra-copy.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.init/dcl.init.ref/p16-cxx0x-no-extra-copy.cpp
cl.init/dcl.init.ref/p5-cxx0x-no-extra-copy.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.init/dcl.init.ref/p5-examples.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
cl.meaning/dcl.fct.default/p5.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.init/dcl.init.ref/p16-cxx0x-no-extra-copy.cpp
cl.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.init/dcl.init.ref/p16-cxx0x-no-extra-copy.cpp
cl.init/dcl.init.ref/p5-cxx03-extra-copy.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.meaning/dcl.ref/p5.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.init/dcl.init.ref/p5.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
cl.meaning/dcl.fct.default/p6.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
cl.init/dcl.init.ref/p5-examples.cpp
cl.init/dcl.init.ref/p5-var.cpp
cl.init/p6.cpp
cl.meaning/dcl.mptr/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.init/p6.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.init/dcl.init.ref/p5.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.init/p6.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.name/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.init/p6.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.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.init/dcl.init.ref/p5-var.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.init/dcl.init.ref/p5-var.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.init/dcl.init.ref/p5-var.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.meaning/dcl.fct.default/p5.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
cl.meaning/dcl.mptr/p3.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.init/dcl.init.ref/basic.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.init/dcl.init.ref/p5-var.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
cl.init/dcl.init.aggr/p4.cpp
cl.init/dcl.init.list/basic.cpp
cl.init/dcl.init.ref/p1.cpp
cl.init/dcl.init.ref/p3.cpp
cl.init/dcl.init.ref/p5-examples.cpp
cl.init/dcl.init.ref/p5-var.cpp
cl.meaning/dcl.array/p1-cxx0x.cpp
cl.meaning/dcl.array/p1.cpp
cl.meaning/dcl.fct.default/p10.cpp
cl.meaning/dcl.fct.default/p2.cpp
cl.meaning/dcl.fct.default/p3.cpp
cl.meaning/dcl.fct.default/p4.cpp
cl.meaning/dcl.fct.default/p5.cpp
cl.meaning/dcl.fct.default/p6.cpp
cl.meaning/dcl.fct.default/p7.cpp
cl.meaning/dcl.fct.default/p8.cpp
cl.meaning/dcl.fct/p3.cpp
cl.meaning/dcl.mptr/p3.cpp
cl.meaning/dcl.ref/p5.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.init/dcl.init.list/basic.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.init/dcl.init.ref/p1.cpp
cl.init/dcl.init.ref/p3.cpp
cl.init/dcl.init.ref/p5-examples.cpp
cl.init/dcl.init.ref/p5-var.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.init/dcl.init.ref/p1.cpp
cl.init/dcl.init.ref/p3.cpp
cl.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.init/dcl.init.ref/p1.cpp
cl.init/dcl.init.ref/p3.cpp
cl.init/dcl.init.ref/p5-var.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.meaning/dcl.fct.default/p4.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.meaning/dcl.mptr/p3.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.meaning/dcl.fct.default/p4.cpp
cl.meaning/dcl.fct/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.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.meaning/dcl.array/p1.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.meaning/dcl.ref/p5.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.init/dcl.init.aggr/p4.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.meaning/dcl.fct/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.meaning/dcl.fct.default/p10.cpp
cl.meaning/dcl.fct.default/p2.cpp
cl.meaning/dcl.fct.default/p3.cpp
cl.meaning/dcl.fct.default/p4.cpp
cl.meaning/dcl.fct.default/p5.cpp
cl.meaning/dcl.fct.default/p6.cpp
cl.meaning/dcl.fct.default/p7.cpp
cl.meaning/dcl.fct.default/p8.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.meaning/dcl.mptr/p3.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.meaning/dcl.mptr/p3.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.meaning/dcl.array/p1-cxx0x.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.meaning/dcl.array/p1-cxx0x.cpp