Skip to content

Commit 20681a1

Browse files
committed
fixup! [clang-tidy] Improved modernize-use-using by fixing a false-negative
Added a few test cases
1 parent 65f7f87 commit 20681a1

File tree

1 file changed

+23
-0
lines changed
  • clang-tools-extra/test/clang-tidy/checkers/modernize

1 file changed

+23
-0
lines changed

clang-tools-extra/test/clang-tidy/checkers/modernize/use-using.cpp

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,4 +359,27 @@ namespace ISSUE_72179
359359
// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: use 'using' instead of 'typedef' [modernize-use-using]
360360
// CHECK-FIXES: using c = struct { int a; union { int b; }; };
361361
}
362+
363+
template <typename T>
364+
void foo3()
365+
{
366+
typedef T b;
367+
// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: use 'using' instead of 'typedef' [modernize-use-using]
368+
// CHECK-FIXES: using b = T;
369+
}
370+
371+
template <typename T>
372+
class MyClass
373+
{
374+
void foo()
375+
{
376+
typedef MyClass c;
377+
// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: use 'using' instead of 'typedef' [modernize-use-using]
378+
// CHECK-FIXES: using c = MyClass;
379+
}
380+
};
381+
382+
const auto foo4 = [](int a){typedef int d;};
383+
// CHECK-MESSAGES: :[[@LINE-1]]:31: warning: use 'using' instead of 'typedef' [modernize-use-using]
384+
// CHECK-FIXES: const auto foo4 = [](int a){using d = int;};
362385
}

0 commit comments

Comments
 (0)