================
@@ -0,0 +1,49 @@
+// RUN: %check_clang_tidy -std=c++23 %s cppcoreguidelines-missing-std-forward 
%t -- -- -fno-delayed-template-parsing
+
+// NOLINTBEGIN
+namespace std {
+
+template <typename T> struct remove_reference      { using type = T; };
+template <typename T> struct remove_reference<T&>  { using type = T; };
+template <typename T> struct remove_reference<T&&> { using type = T; };
+
+template <typename T> using remove_reference_t = typename 
remove_reference<T>::type;
+
+template <typename T> constexpr T &&forward(remove_reference_t<T> &t) noexcept;
+template <typename T> constexpr T &&forward(remove_reference_t<T> &&t) 
noexcept;
+template <typename T> constexpr remove_reference_t<T> &&move(T &&x);
+
+template <class T, class U>
+concept derived_from = __is_base_of(U, T);
+
+template <class T>
+concept integral = __is_integral(T);
+
+} // namespace std
+// NOLINTEND
+
+// Tests for constrained template parameters (GH#180362).
+
+class GH180362_A {
+public:
+  template <std::derived_from<GH180362_A> Self>
+  auto operator|(this Self &&self, int) -> void {}
+};
+
+template <std::integral T>
+void gh180362_takes_integral(T &&t) {}
----------------
vbvictor wrote:

This seems like a false negative, from [cppinsights](https://cppinsights.io/):

Orig
```cpp
template <class T>
concept integral = true;

template <integral T>
void takes_integral(T &&t) {}

int main() {
    int a = 0;

    takes_integral(0);
    takes_integral(a);
}
```

Transformed
```cpp
template<class T>
concept integral = true;


template<integral T>
void takes_integral(T && t)
{
}

/* First instantiated from: insights.cpp:10 */
#ifdef INSIGHTS_USE_TEMPLATE
template<>
void takes_integral<int>(int && t)
{
}
#endif


/* First instantiated from: insights.cpp:11 */
#ifdef INSIGHTS_USE_TEMPLATE
template<>
void takes_integral<int &>(int & t)
{
}
#endif


int main()
{
  int a = 0;
  takes_integral(0);
  takes_integral(a);
  return 0;
}
```

https://github.com/llvm/llvm-project/pull/182038
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to