Summary: The fix for `auto` new expression is illegal.
Reviewers: aaron.ballman
Subscribers: xazax.hun, cfe-commits
Differential Revision: https://reviews.llvm.org/D54832
llvm-svn: 347551
if (New->getNumPlacementArgs() != 0)
return;
+ // Skip when this is a new-expression with `auto`, e.g. new auto(1)
+ if (New->getType()->getPointeeType()->getContainedAutoType())
+ return;
// Be conservative for cases where we construct an array without any
// initalization.
// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: use std::make_unique instead
// CHECK-FIXES: PE1 = std::make_unique<E>();
+ // No warnings for `auto` new expression.
+ PE1.reset(new auto(E()));
+
//============================================================================
// NOTE: For initlializer-list constructors, the check only gives warnings,
// and no fixes are generated.