This was an omission from r232229.
llvm-svn: 232554
SourceLocation RBrac,
AttributeList *AttrList);
void ActOnFinishCXXMemberDecls();
- void ActOnFinishCXXMethodDefs(Decl *D);
+ void ActOnFinishCXXMemberDefaultArgs(Decl *D);
void ActOnReenterCXXMethodParameter(Scope *S, ParmVarDecl *Param);
unsigned ActOnReenterTemplateScope(Scope *S, Decl *Template);
// Add the rest of the default arguments.
std::vector<Stmt *> ArgVec;
- for (unsigned I = IsCopy ? 1 : 0, E = CD->getNumParams(); I != E; ++I)
- ArgVec.push_back(getContext().getDefaultArgExprForConstructor(CD, I));
+ for (unsigned I = IsCopy ? 1 : 0, E = CD->getNumParams(); I != E; ++I) {
+ Stmt *DefaultArg = getContext().getDefaultArgExprForConstructor(CD, I);
+ assert(DefaultArg && "sema forgot to instantiate default args");
+ ArgVec.push_back(DefaultArg);
+ }
CodeGenFunction::RunCleanupsScope Cleanups(CGF);
// We've finished parsing everything, including default argument
// initializers.
- Actions.ActOnFinishCXXMethodDefs(TagDecl);
+ Actions.ActOnFinishCXXMemberDefaultArgs(TagDecl);
}
if (TagDecl)
}
}
-void Sema::ActOnFinishCXXMethodDefs(Decl *D) {
+void Sema::ActOnFinishCXXMemberDefaultArgs(Decl *D) {
auto *RD = dyn_cast<CXXRecordDecl>(D);
// Default constructors that are annotated with __declspec(dllexport) which
SourceLocation(), SourceLocation(), nullptr);
CheckCompletedCXXClass(Instantiation);
+ // Default arguments are parsed, if not instantiated. We can go instantiate
+ // default arg exprs for default constructors if necessary now.
+ ActOnFinishCXXMemberDefaultArgs(Instantiation);
+
// Instantiate late parsed attributes, and attach them to their decls.
// See Sema::InstantiateAttrs
for (LateInstantiatedAttrVec::iterator I = LateAttrs.begin(),
// M32-DAG: define weak_odr dllexport x86_thiscallcc void @"\01??_FNestedOuter@@QAEXXZ"
// M32-DAG: define weak_odr dllexport x86_thiscallcc void @"\01??_FNestedInner@NestedOuter@@QAEXXZ"
+template <typename T>
+struct SomeTemplate {
+ SomeTemplate(T o = T()) : o(o) {}
+ T o;
+};
+struct __declspec(dllexport) InheritFromTemplate : SomeTemplate<int> {};
+
+// M32-DAG: define weak_odr dllexport x86_thiscallcc void @"\01??_F?$SomeTemplate@H@@QAEXXZ"
+
struct __declspec(dllexport) T {
// Copy assignment operator:
// M32-DAG: define weak_odr dllexport x86_thiscallcc dereferenceable({{[0-9]+}}) %struct.T* @"\01??4T@@QAEAAU0@ABU0@@Z"