Commit Graph

890 Commits

Author SHA1 Message Date
David Blaikie b06c68d320 Move tests to the appropriate directory to match the spec hierarchy.
llvm-svn: 143906
2011-11-07 03:27:58 +00:00
Eli Friedman 3ba20c1571 Make test work with ARM C++ ABI.
llvm-svn: 143425
2011-11-01 03:30:32 +00:00
Richard Smith 53cafabac0 Add test missed from r143234.
llvm-svn: 143257
2011-10-29 00:03:08 +00:00
Eli Friedman 64d9504b8f Compute the promoted integer type of fixed-width enums correctly. Found by inspection.
llvm-svn: 143021
2011-10-26 07:38:19 +00:00
Eli Friedman 3f37c1ce4c Correctly perform integral promotions on wchar_t/char16_t/char32_t in C++. <rdar://problem/10309088>.
llvm-svn: 143019
2011-10-26 07:22:48 +00:00
David Blaikie dd58d4ca8f Handle redundant 'typename' on base class specifications.
llvm-svn: 142937
2011-10-25 18:46:41 +00:00
David Blaikie afa155fb88 Fix erroneous name-specifiers prior to decltypes better/correctly as per Doug's feedback.
llvm-svn: 142935
2011-10-25 18:17:58 +00:00
David Blaikie 1cd50022b2 Fix cases where the optional nested-name-specifier erroneously preceeded a decltype-specification when specifying a base type.
llvm-svn: 142928
2011-10-25 17:10:12 +00:00
David Blaikie 00ee7a081d Support the use of decltype for specifying base types. Fixes PR11216.
llvm-svn: 142926
2011-10-25 15:01:20 +00:00
Douglas Gregor baabbb779d Undo unnecessary change
llvm-svn: 142907
2011-10-25 03:47:25 +00:00
Douglas Gregor ab6bc1d13e 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.

llvm-svn: 142903
2011-10-25 03:07:45 +00:00
Peter Collingbourne 7d33cd3a2f Fix grammar for C++11 alignment specifiers, and add a few FIXMEs.
llvm-svn: 142760
2011-10-23 20:07:52 +00:00
Peter Collingbourne 9f58d7b789 Diagnose unexpanded parameter packs in member initialisers (including
in-class member initialisers).

llvm-svn: 142758
2011-10-23 18:59:44 +00:00
Peter Collingbourne e109a2ca59 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.

llvm-svn: 142755
2011-10-23 17:07:16 +00:00
Peter Collingbourne 99eddc3d92 Permit auto SCS on parameter declarations, C++03 [dcl.stc]p2
llvm-svn: 142649
2011-10-21 11:55:09 +00:00
Richard Smith fe2750db42 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.

llvm-svn: 142619
2011-10-20 21:42:12 +00:00
Richard Smith f411196d15 '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.

llvm-svn: 142597
2011-10-20 18:35:58 +00:00
David Blaikie 651c73ce78 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.
llvm-svn: 142473
2011-10-19 05:19:50 +00:00
Richard Smith aed32b4d8c 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.

llvm-svn: 142411
2011-10-18 20:08:55 +00:00
Richard Smith c30493db3c In C++11, a class's members are allowed to be nominated as friends.
llvm-svn: 142393
2011-10-18 18:33:57 +00:00
David Blaikie cc5f8f0d9e Switch to the C++11 warning flags in tests.
Patch by Ahmed Charles!

llvm-svn: 142340
2011-10-18 05:54:07 +00:00
John McCall 4124c4924d 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.

llvm-svn: 142219
2011-10-17 18:40:02 +00:00
Douglas Gregor 7e1aa5b7ac 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>.

llvm-svn: 141986
2011-10-14 20:34:19 +00:00
Richard Smith 465841e48c [temp.explicit]p1: constexpr cannot be specified in explicit instantiations.
llvm-svn: 141982
2011-10-14 19:58:02 +00:00
Richard Smith 9ca5c42582 Update all tests other than Driver/std.cpp to use -std=c++11 rather than
-std=c++0x. Patch by Ahmed Charles!

llvm-svn: 141900
2011-10-13 22:29:44 +00:00
Douglas Gregor cda2270217 Allow calling an overloaded function set by taking the address of the
functions, e.g., (&f)(0). Fixes <rdar://problem/9803316>.

llvm-svn: 141877
2011-10-13 18:10:35 +00:00
Douglas Gregor ebcfbb5d22 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.

llvm-svn: 141809
2011-10-12 20:35:48 +00:00
Douglas Gregor 205d044552 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.

llvm-svn: 141801
2011-10-12 19:26:40 +00:00
Richard Smith fd53aaf7e7 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.

llvm-svn: 141768
2011-10-12 05:08:15 +00:00
John McCall 50a2c2c19d 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.

llvm-svn: 141738
2011-10-11 23:14:30 +00:00
Alexis Hunt 77c1f9f888 Get rid of ShouldDeleteMoveConstructor.
llvm-svn: 141650
2011-10-11 06:43:29 +00:00
Alexis Hunt 1bc6f71ebc Consolidate copy constructor deletion into ShouldDeleteSpecialMember.
llvm-svn: 141645
2011-10-11 04:55:36 +00:00
Douglas Gregor ab96bcf6ea 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.

llvm-svn: 141568
2011-10-10 18:59:29 +00:00
Douglas Gregor 556e5860f9 Per C++ [class.bit]p2, unnamed bit-fields are not members. Fixes PR10289.
llvm-svn: 141549
2011-10-10 17:22:13 +00:00
Richard Smith f368fb40df 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.

llvm-svn: 141547
2011-10-10 16:38:04 +00:00
Douglas Gregor b06fa540e8 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.

llvm-svn: 141543
2011-10-10 16:05:18 +00:00
Douglas Gregor 877d4ebba4 Always add the built-in overload candidates for operators &&, ||, and
!. Fixes PR9865.

llvm-svn: 141537
2011-10-10 14:05:31 +00:00
Alexis Hunt d6da876bac 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.

llvm-svn: 141528
2011-10-10 06:18:57 +00:00
Douglas Gregor 16e65616d6 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. 

llvm-svn: 141524
2011-10-10 01:11:59 +00:00
Douglas Gregor 56636589ff The effective context of a friend function is its lexical
context. Fixes PR9103.

llvm-svn: 141520
2011-10-09 22:38:36 +00:00
Douglas Gregor 0c83c8128b 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.

llvm-svn: 141517
2011-10-09 22:06:46 +00:00
Douglas Gregor e9d075e434 A friend template specialization is also dependent if any of its
template arguments are dependent. Fixes PR10913.

llvm-svn: 141515
2011-10-09 20:59:17 +00:00
Douglas Gregor bb64afcc39 Diagnose attempts to declare a non-static data member with a
non-identifier name. Fixes PR10839.

llvm-svn: 141513
2011-10-09 18:55:59 +00:00
Douglas Gregor 4d328b6e16 After instantiating a 'noexcept' expression, be sure to convert it to
a boolean value and check that it is a constant expression. Fixes
PR11084.

llvm-svn: 141511
2011-10-09 18:31:23 +00:00
Richard Smith 43a87fe86a 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.
llvm-svn: 141279
2011-10-06 09:21:12 +00:00
Douglas Gregor b0e6c8a350 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>.

llvm-svn: 141137
2011-10-04 23:59:32 +00:00
Richard Smith eb3c10c248 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.

llvm-svn: 140926
2011-10-01 02:31:28 +00:00
Richard Smith 7cd25b2836 constexpr functions are implicitly const. More tests to follow.
llvm-svn: 140831
2011-09-30 00:45:47 +00:00
Richard Smith 7b729cdbff Suggest adding 'constexpr' if the GNU extension for in-class initializers for static const float members is used in C++11 mode.
llvm-svn: 140828
2011-09-30 00:33:19 +00:00
Richard Smith 256336d9ab 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.
llvm-svn: 140820
2011-09-29 23:18:34 +00:00