Commit Graph

9 Commits

Author SHA1 Message Date
Eli Friedman c9817fdf16 When we're synthesizing copy/move-assignment, we can't form a reference to an
invalid field; make sure we don't try.  Fixes <rdar://problem/14084171>.

llvm-svn: 183479
2013-06-07 01:48:56 +00:00
Richard Smith 27874d603b PR14838: When a member reference is bound to a temporary, don't forget to
perform the semantic checks associated with the destruction of that temporary.
It'll be destroyed at the end of the constructor.

llvm-svn: 171818
2013-01-08 00:08:23 +00:00
Richard Smith d3b5c90865 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).

llvm-svn: 160847
2012-07-27 04:22:15 +00:00
Richard Smith 45855df4c6 Recover properly if a class member declaration starts with a scope specifier
or template-id which can't be parsed.

llvm-svn: 156468
2012-05-09 08:23:23 +00:00
David Blaikie cdd91dbe9f Fix crash-on-invalid for 'operator int[]()' in C++11.
Signed off by Richard Smith.

llvm-svn: 150464
2012-02-14 09:00:46 +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 5ca153f112 When parsing a function-try-block that does not have a
ctor-initializer, remember to call the Sema action to generate default
ctor-initializers. What a delightful little miscompile. Fixes PR10578
/ <rdar://problem/9877267>.

llvm-svn: 139253
2011-09-07 20:36:12 +00:00
Richard Smith 4a4beec7b0 Don't assert on initialized typedef declarations in classes:
struct {
    typedef int A = 0;
  };

According to the C++11 standard, this is not ill-formed, but does not have any ascribed meaning. We can't reasonably accept it, so treat it as ill-formed.

Also switch C++ from an incorrect 'fields can only be initialized in constructors' diagnostic for this case to C's 'illegal initializer (only variables can be initialized)'

llvm-svn: 132890
2011-06-12 11:43:46 +00:00
Richard Smith 938f40b5aa Implement support for C++11 in-class initialization of non-static data members.
llvm-svn: 132878
2011-06-11 17:19:42 +00:00