[PATCH] D119544: Deferred Concept Instantiation Implementation

Erich Keane via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 25 11:03:49 PDT 2022


erichkeane added a comment.

Here is the example I'm playing with:

  template<typename T>
  constexpr bool constraint = true;
  
  #define BROKE_REQUIRES 1
  #define WORKING_REQUIRES 2
  #define WORKING_BODY 3
   
  #define TEST BROKE_REQUIRES
  //#define TEST WORKING_REQUIRES
  //#define TEST WORKING_BODY
   
  template<typename T>
  struct S {
    T t;
    void foo()
  #if TEST == BROKE_REQUIRES
      requires (constraint<decltype(t)>)
  #endif
      {
  #if TEST == WORKING_BODY
      using G = decltype(t);
  #endif
    }
  #if TEST == WORKING_REQUIRES
    template<typename U>
    void foo2() requires (constraint<decltype(t)>){}
  #endif
  };
   
  void bar() {
    S<int> s;
  #if TEST == BROKE_REQUIRES || TEST == WORKING_BODY
    s.foo();
  #endif
  #if TEST == WORKING_REQUIRES
    s.foo2<int>();
  #endif
  }

For all 3 versions (see the definitions of TEST), they get to 6083 on the 1st breakpoint.


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

https://reviews.llvm.org/D119544



More information about the cfe-commits mailing list