forked from OSchip/llvm-project
Add hack to make the given testcase work. As far as I can tell, this change is
reasonably safe, but it doesn't seem like the right solution. llvm-svn: 86508
This commit is contained in:
parent
e5eb726e2e
commit
cb29876839
|
@ -188,11 +188,13 @@ Decl *TemplateDeclInstantiator::VisitVarDecl(VarDecl *D) {
|
|||
Var->setInvalidDecl();
|
||||
else if (!D->getType()->isDependentType() &&
|
||||
!D->getInit()->isTypeDependent() &&
|
||||
!D->getInit()->isValueDependent()) {
|
||||
!D->getInit()->isValueDependent() &&
|
||||
!isa<InitListExpr>(D->getInit())) {
|
||||
// If neither the declaration's type nor its initializer are dependent,
|
||||
// we don't want to redo all the checking, especially since the
|
||||
// initializer might have been wrapped by a CXXConstructExpr since we did
|
||||
// it the first time.
|
||||
// FIXME: The InitListExpr handling here is a hack!
|
||||
Var->setInit(SemaRef.Context, Init.takeAs<Expr>());
|
||||
}
|
||||
else if (ParenListExpr *PLE = dyn_cast<ParenListExpr>((Expr *)Init.get())) {
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
// RUN: clang-cc %s -emit-llvm-only -verify
|
||||
|
||||
struct F {
|
||||
void (*x)();
|
||||
};
|
||||
void G();
|
||||
template<class T> class A {
|
||||
A();
|
||||
};
|
||||
template<class T> A<T>::A() {
|
||||
static F f = { G };
|
||||
}
|
||||
A<int> a;
|
Loading…
Reference in New Issue