[PATCH] D76038: PR45000: Let Sema::SubstParmVarDecl handle default args of lambdas in initializers

Aaron Puchert via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Apr 19 15:29:48 PDT 2020


aaronpuchert marked 2 inline comments as done.
aaronpuchert added a comment.

This seems to be in line with our current behavior, so I hope it's right:

  struct S { S(int); };
  
  template<typename T>
  auto l = [](T x = T()) { return x; };
  
  template<typename T>
  struct Fun {
      T operator()(T x = T()) const { return x; }
  };
  
  void f() {
      l<int>();   // Ok.
      l<S>(S(0)); // Error at "T()": no matching constructor for initialization of 'S'
      Fun<S> f;
      f(S(0));    // Ok.
  }


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76038





More information about the cfe-commits mailing list