llvm-project/clang/test/CXX
Reid Kleckner d60b82f93e Handle use of default member initializers before end of outermost class
Specifically, when we have this situation:
  struct A {
    template <typename T> struct B {
      int m1 = sizeof(A);
    };
    B<int> m2;
  };

We can't parse m1's initializer eagerly because we need A to be
complete.  Therefore we wait until the end of A's class scope to parse
it. However, we can trigger instantiation of B before the end of A,
which will attempt to instantiate the field decls eagerly, and it would
build a bad field decl instantiation that said it had an initializer but
actually lacked one.

Fixed by deferring instantiation of default member initializers until
they are needed during constructor analysis. This addresses a long
standing FIXME in the code.

Fixes PR19195.

Reviewed By: rsmith

Differential Revision: http://reviews.llvm.org/D5690

llvm-svn: 222192
2014-11-17 23:36:45 +00:00
..
basic Revert "clang/test/Driver/crash-report.c: This requires rewriter for -frewrite-includes. [PR20321]" 2014-07-16 15:12:48 +00:00
class PR21437, final part of DR1330: delay-parsing of exception-specifications. This 2014-11-13 20:01:57 +00:00
class.access When formatting a C++-only declaration name, enable C++ mode in the formatter's 2014-01-22 00:27:42 +00:00
class.derived Revert r218925 - "Patch to warn if 'override' is missing" 2014-10-03 09:02:53 +00:00
conv 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. 2012-10-19 12:44:48 +00:00
dcl.dcl [c++1z] Support [[deprecated]] attributes on namespaces. Note that it only applies to situations where the namespace is mentioned. Thus, use on anonymous namespaces is diagnosed. 2014-11-14 22:34:56 +00:00
dcl.decl First half of CWG1962: decltype(__func__) should not be a reference type, 2014-11-11 19:30:41 +00:00
drs PR21437, final part of DR1330: delay-parsing of exception-specifications. This 2014-11-13 20:01:57 +00:00
except Instantiate exception specifications when instantiating function types (other 2014-11-12 02:00:47 +00:00
expr Handle use of default member initializers before end of outermost class 2014-11-17 23:36:45 +00:00
lex Improving the "integer constant too large" diagnostics based on post-commit feedback from Richard Smith. Amends r213657. 2014-07-24 14:51:23 +00:00
over Implement [over.match.oper]p3 properly, by filtering the non-candidates out 2014-04-17 01:52:14 +00:00
special Replace "can not" with "cannot" in diagnostics messages. 2014-03-07 22:36:23 +00:00
stmt.stmt Reword switch/goto diagnostics "protected scope" diagnostics. Making up a term 2014-09-06 00:24:58 +00:00
temp Handle use of default member initializers before end of outermost class 2014-11-17 23:36:45 +00:00