Should reject C auto *f() when deduced return type doesn't satisfy C · Issue #53911 · llvm/llvm-project (original) (raw)

Similar to #49188, but whereas in that issue the problem was an auto return type being deduced to void, here the problem is the auto in the return type being modified by a pointer qualification. For example: https://godbolt.org/z/T8j3j7j58

namespace Bug {
  template<class T> concept C = false;

  C auto *f() {
    return (int*)nullptr;
  }
}

This should be a hard error, because auto deduces to int and C<int> is false. But instead, Clang silently accepts!