Don't forget to define them if they're constexpr and used inside a
template; we might try to evaluate a call to them before the template is
instantiated.
}
static bool isImplicitlyDefinableConstexprFunction(FunctionDecl *Func) {
- return Func->isConstexpr() &&
- (Func->isImplicitlyInstantiable() || !Func->isUserProvided());
+ if (!Func->isConstexpr())
+ return false;
+
+ if (Func->isImplicitlyInstantiable() || !Func->isUserProvided())
+ return true;
+ auto *CCD = dyn_cast<CXXConstructorDecl>(Func);
+ return CCD && CCD->getInheritedConstructor();
}
/// Mark a function referenced, and check whether it is odr-used
S0<int> s0;
}
}
+
+namespace PR47555 {
+ struct A { constexpr A(int) {} };
+ struct B : A { using A::A; };
+ template<typename> void f() {
+ constexpr B b = 0;
+ };
+ template void f<int>();
+}