File tree 2 files changed +19
-1
lines changed
2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -190,8 +190,10 @@ class CastSequenceVisitor : public RecursiveASTVisitor<CastSequenceVisitor> {
190
190
bool VisitStmt (Stmt *S) {
191
191
auto *C = dyn_cast<CastExpr>(S);
192
192
// Catch the castExpr inside cxxDefaultArgExpr.
193
- if (auto *E = dyn_cast<CXXDefaultArgExpr>(S))
193
+ if (auto *E = dyn_cast<CXXDefaultArgExpr>(S)) {
194
194
C = dyn_cast<CastExpr>(E->getExpr ());
195
+ FirstSubExpr = nullptr ;
196
+ }
195
197
if (!C) {
196
198
FirstSubExpr = nullptr ;
197
199
return true ;
Original file line number Diff line number Diff line change @@ -228,3 +228,19 @@ struct D {
228
228
void test_default_argument () {
229
229
D (nullptr );
230
230
}
231
+
232
+ // Test on two neighbour CXXDefaultArgExprs nodes.
233
+ typedef unsigned long long uint64;
234
+ struct ZZ {
235
+ explicit ZZ (uint64, const uint64* = NULL ) {}
236
+ // CHECK-MESSAGES: :[[@LINE-1]]:39: warning: use nullptr
237
+ // CHECK-FIXES: explicit ZZ(uint64, const uint64* = nullptr) {}
238
+ operator bool () { return true ; }
239
+ };
240
+
241
+ uint64 Hash (uint64 seed = 0 ) { return 0 ; }
242
+
243
+ void f () {
244
+ bool a;
245
+ a = ZZ (Hash ());
246
+ }
You can’t perform that action at this time.
0 commit comments