[clang] [Clang] prevent null explicit object argument from being deduced (PR #104328)

via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 14 15:54:51 PDT 2024


================
@@ -0,0 +1,30 @@
+// RUN: %clang_cc1 -fsyntax-only -std=c++2b -verify %s
+
+namespace std {
+struct rv {};
+
+template <bool B, typename T> struct enable_if;
+template <typename T> struct enable_if<true, T> { typedef T type; };
+
+template <typename U, typename T>
+typename enable_if<__is_convertible(T, rv), U>::type forward(T &);
+template <typename U, typename T>
+typename enable_if<!__is_convertible(T, rv), U &>::type forward(T &);
+}
+
+struct Foo {
+  template <class T>
+  constexpr auto operator[](this T &&self, auto... i)        // expected-note {{candidate template ignored: substitution failure [with T = Foo &, i:auto = <>]: member '_evaluate' used before its declaration}}
+      -> decltype(_evaluate(std::forward<T>(self), i...)) {
----------------
cor3ntin wrote:

```suggestion
      -> decltype(_evaluate(self, i...)) {
```

https://github.com/llvm/llvm-project/pull/104328


More information about the cfe-commits mailing list