hubert.reinterpretcast added a comment.

I am concerned that the general direction of this patch (to allow the 
previously ill-formed constexpr functions as an extension under older language 
levels) is based upon bugs/divergences-from-orthodoxy in Clang's implementation 
of C++20 (noting that the committee discussion did not agree with Clang's split 
between the template and non-template cases).

Evaluating "an invocation of an instantiated constexpr function that fails to 
satisfy the requirements for a constexpr function" causes an expression to not 
be a core constant expression. The ability to SFINAE on this can be 
demonstrated using GCC.

For the following case under C++20, GCC finds that the template candidate 
suffers from substitution failure (Clang doesn't):
https://godbolt.org/z/h71ffYafM

  struct NonLiteral {
    NonLiteral();
    operator int();
  } *pNL = 0;
  
  template <typename T, T> struct ValueSink;
  
  template <typename T>
  struct A {
    constexpr int f() {
      return 42;
      T t;
    }
  };
  
  short *f(void *);
  
  template <typename T>
  long *f(T *, ValueSink<int, A<T>().f()> * = 0);
  
  using retty = decltype(f(pNL));
  typedef short *retty;


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D111400

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to