[PATCH] D155064: [clang][SemaCXX] Diagnose tautological uses of consteval if and is_constant_evaluated

Alex Brachet via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 27 09:29:40 PDT 2023


abrachet added a comment.

  struct S {
    template <typename F>
    constexpr bool a(F&& f) const {
      // This works previously in clang and on gcc
      return f(1); // no matching function for call to object of type ...
    }
  };
  
  template <typename>
  struct S1 {
    void f() {
      auto test = [] (auto) {
        S s;
        // Remove this constexpr and it compiles fine.
        constexpr auto f = [](auto&&) { return true; };
        return s.a(f);
      };
      test(1);
    }
  };
  
  void a() {
    S1<int> s;
    s.f();
  }

The following doesn't compile after this change (I've verified that reverting makes the issue go away). This code also compiles fine on gcc. Would you mind taking a look?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D155064/new/

https://reviews.llvm.org/D155064



More information about the cfe-commits mailing list