[cfe-commits] r134483 - in /cfe/trunk: lib/Sema/TreeTransform.h test/CodeGenCXX/variadic-templates.cpp
Douglas Gregor
dgregor at apple.com
Wed Jul 6 07:39:56 PDT 2011
On Jul 6, 2011, at 12:30 AM, John McCall wrote:
> Author: rjmccall
> Date: Wed Jul 6 02:30:07 2011
> New Revision: 134483
>
> URL: http://llvm.org/viewvc/llvm-project?rev=134483&view=rev
> Log:
> When tree-transforming an expression sequence, always flag expanded
> variadic argument pack expansions as having changed, rather than doing
> it for each changed expansion, which leaves out zero-argument packs
> with catastrophic consequences.
>
> Fixes PR10260.
>
>
> Modified:
> cfe/trunk/lib/Sema/TreeTransform.h
> cfe/trunk/test/CodeGenCXX/variadic-templates.cpp
>
> Modified: cfe/trunk/lib/Sema/TreeTransform.h
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/TreeTransform.h?rev=134483&r1=134482&r2=134483&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Sema/TreeTransform.h (original)
> +++ cfe/trunk/lib/Sema/TreeTransform.h Wed Jul 6 02:30:07 2011
> @@ -1547,9 +1547,9 @@
> /// By default, performs semantic analysis to build the new expression.
> /// Subclasses may override this routine to provide different behavior.
> ExprResult RebuildInitList(SourceLocation LBraceLoc,
> - MultiExprArg Inits,
> - SourceLocation RBraceLoc,
> - QualType ResultTy) {
> + MultiExprArg Inits,
> + SourceLocation RBraceLoc,
> + QualType ResultTy) {
> ExprResult Result
> = SemaRef.ActOnInitList(LBraceLoc, move(Inits), RBraceLoc);
> if (Result.isInvalid() || ResultTy->isDependentType())
> @@ -2476,6 +2476,10 @@
> Outputs.push_back(Out.get());
> continue;
> }
> +
> + // Record right away that the argument was changed. This needs
> + // to happen even if the array expands to nothing.
> + if (ArgChanged) *ArgChanged = true;
>
> // The transform has determined that we should perform an elementwise
> // expansion of the pattern. Do so.
> @@ -2492,8 +2496,6 @@
> return true;
> }
>
> - if (ArgChanged)
> - *ArgChanged = true;
> Outputs.push_back(Out.get());
> }
Ah hah… nice catch!
- Doug
More information about the cfe-commits
mailing list