[cfe-commits] r86508 - in /cfe/trunk: lib/Sema/SemaTemplateInstantiateDecl.cpp test/CodeGenCXX/instantiate-init-list.cpp

Douglas Gregor dgregor at apple.com
Mon Nov 9 09:17:38 PST 2009


On Nov 8, 2009, at 7:59 PM, Eli Friedman wrote:

> Author: efriedma
> Date: Sun Nov  8 21:59:26 2009
> New Revision: 86508
>
> URL: http://llvm.org/viewvc/llvm-project?rev=86508&view=rev
> Log:
> 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.
>
>
> Added:
>    cfe/trunk/test/CodeGenCXX/instantiate-init-list.cpp
> Modified:
>    cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
>
> Modified: cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp?rev=86508&r1=86507&r2=86508&view=diff
>
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp (original)
> +++ cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp Sun Nov  8  
> 21:59:26 2009
> @@ -188,11 +188,13 @@
>       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>());
>     }


This hack isn't going to work in general, because we'll end up re-type- 
checking initializers within the InitListExpr. The actual problem here  
is that the transformed InitListExpr lost the type information of the  
original InitListExpr (and got set to Context.VoidTy); I've fixed the  
issue in r86559.

	- Doug



More information about the cfe-commits mailing list