Issue 172243
Summary [clang][frontend] Clang not entirely consistent in handling `template-id`s that refer to the current instantiation
Labels c++, clang:frontend
Assignees
Reporter localspook
    (Disclaimer: not a language lawyer)

Consider this class ([godbolt](https://godbolt.org/z/bez7vKPad)):
```cpp
template<int i>
struct S {
    static constexpr int n = i;
    using U = S<n>;
 S(const U&) = default;
    S(U&&) = default;
    U& operator=(const U& u) = default;
    U& operator=(U&& u) = default;
    ~S() = default;
};
```
In my understanding, inside the class, `U` refers to the current instantiation according to the equivalence rules in [[temp.dep.type]/2](https://eel.is/c++draft/temp.dep#type-2). This means that, for example, `S(U&&) = default;` is *known* to be a move constructor, even without instantiating the template. But this isn't reflected in the AST; calling `isMoveConstructor` on that `CXXConstructorDecl` returns false. This leads to false positives in certain clang-tidy checks (#116055).

_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to