File tree Expand file tree Collapse file tree 3 files changed +30
-2
lines changed Expand file tree Collapse file tree 3 files changed +30
-2
lines changed Original file line number Diff line number Diff line change @@ -184,8 +184,16 @@ void UnusedUsingDeclsCheck::check(const MatchFinder::MatchResult &Result) {
184
184
return ;
185
185
}
186
186
// Check user-defined literals
187
- if (const auto *UDL = Result.Nodes .getNodeAs <UserDefinedLiteral>(" used" ))
188
- removeFromFoundDecls (UDL->getCalleeDecl ());
187
+ if (const auto *UDL = Result.Nodes .getNodeAs <UserDefinedLiteral>(" used" )) {
188
+ const Decl *CalleeDecl = UDL->getCalleeDecl ();
189
+ if (const auto *FD = dyn_cast<FunctionDecl>(CalleeDecl)) {
190
+ if (const FunctionTemplateDecl *FPT = FD->getPrimaryTemplate ()) {
191
+ removeFromFoundDecls (FPT);
192
+ return ;
193
+ }
194
+ }
195
+ removeFromFoundDecls (CalleeDecl);
196
+ }
189
197
}
190
198
191
199
void UnusedUsingDeclsCheck::removeFromFoundDecls (const Decl *D) {
Original file line number Diff line number Diff line change @@ -138,6 +138,10 @@ Changes in existing checks
138
138
<clang-tidy/checks/performance/move-const-arg>` check by fixing false negatives
139
139
on ternary operators calling ``std::move ``.
140
140
141
+ - Improved :doc: `misc-unused-using-decls
142
+ <clang-tidy/checks/misc/unused-using-decls>` check by fixing false positives
143
+ on ``operator"" `` with template parameters.
144
+
141
145
Removed checks
142
146
^^^^^^^^^^^^^^
143
147
Original file line number Diff line number Diff line change @@ -222,3 +222,19 @@ using gh69714::StructGH69714_1;
222
222
using gh69714::StructGH69714_2;
223
223
struct StructGH69714_1 a;
224
224
struct StructGH69714_2 *b;
225
+
226
+ namespace gh53444 {
227
+ namespace my_literals {
228
+ template <char ... Ts>
229
+ int operator " " _r() {
230
+ return {};
231
+ }
232
+ }
233
+
234
+ using my_literals::operator " " _r;
235
+
236
+ int foo () {
237
+ auto x2 = 123_r;
238
+ }
239
+
240
+ }
You can’t perform that action at this time.
0 commit comments