-
- Downloads
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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@222192 91177308-0d34-0410-b5e6-96231b3b80d8
Showing
- include/clang/AST/DeclBase.h 7 additions, 0 deletionsinclude/clang/AST/DeclBase.h
- include/clang/AST/ExprCXX.h 8 additions, 2 deletionsinclude/clang/AST/ExprCXX.h
- include/clang/Basic/DiagnosticSemaKinds.td 8 additions, 3 deletionsinclude/clang/Basic/DiagnosticSemaKinds.td
- include/clang/Sema/Sema.h 6 additions, 0 deletionsinclude/clang/Sema/Sema.h
- lib/AST/DeclBase.cpp 11 additions, 0 deletionslib/AST/DeclBase.cpp
- lib/AST/Expr.cpp 4 additions, 2 deletionslib/AST/Expr.cpp
- lib/Sema/SemaDeclCXX.cpp 61 additions, 29 deletionslib/Sema/SemaDeclCXX.cpp
- lib/Sema/SemaInit.cpp 7 additions, 3 deletionslib/Sema/SemaInit.cpp
- lib/Sema/SemaTemplateInstantiate.cpp 91 additions, 31 deletionslib/Sema/SemaTemplateInstantiate.cpp
- test/CXX/expr/expr.prim/expr.prim.lambda/templates.cpp 2 additions, 2 deletionstest/CXX/expr/expr.prim/expr.prim.lambda/templates.cpp
- test/CXX/temp/temp.param/p5.cpp 4 additions, 4 deletionstest/CXX/temp/temp.param/p5.cpp
- test/SemaCXX/constant-expression-cxx11.cpp 3 additions, 2 deletionstest/SemaCXX/constant-expression-cxx11.cpp
- test/SemaCXX/implicit-exception-spec.cpp 12 additions, 10 deletionstest/SemaCXX/implicit-exception-spec.cpp
- test/SemaCXX/member-init.cpp 76 additions, 1 deletiontest/SemaCXX/member-init.cpp
- test/SemaTemplate/instantiate-init.cpp 1 addition, 0 deletionstest/SemaTemplate/instantiate-init.cpp
Loading
Please register or sign in to comment