Issue 134861
Summary Clang rejects a valid generic lamba within a conditional explicit for a constructor template of a class template
Labels clang
Assignees
Reporter AlisdairM
    In the following example, all 5 variable declarations should succeed, but the three instantiations of a class template fail, leaving only the non-template classes to succeed.  This interpretation has been validated against current gcc compilers.

Code example also available at Godbolt: https://godbolt.org/z/d488W9xGn

```
#include <type_traits>
#include <utility>

struct Best {
   template <class ...U>
   explicit( []<std::size_t ...I>(std::index_sequence<I...>) consteval
               { return sizeof...(U) > 1; }
               ( std::index_sequence<1uz>{} )
 )
   Yest(U const &...)
   {}
};

struct Jest {
   template <class ...U>
   explicit( []<std::size_t I>(std::index_sequence<I>) consteval
               { return sizeof...(U) > 1; }
               ( std::index_sequence<1uz>{} )
           )
   Zest(U const &...)
 {}
};

template <typename ...T>
struct Test {
   template <class ...U>
 explicit( []<std::size_t ...I>(std::index_sequence<I...>) consteval
 { return sizeof...(U) > 1; }
               ( std::index_sequence_for<T...>{} )
           )
   Test(U const &...)
 {}
};


template <typename T>
struct Yest {
   template <class ...U>
 explicit( []<std::size_t ...I>(std::index_sequence<I...>) consteval
 { return sizeof...(U) > 1; }
               ( std::index_sequence<1uz>{} )
           )
   Yest(U const &...)
 {}
};

template <typename T>
struct Zest {
   template <class ...U>
 explicit( []<std::size_t I>(std::index_sequence<I>) consteval
 { return sizeof...(U) > 1; }
               ( std::index_sequence<1uz>{} )
 )
   Zest(U const &...)
   {}
};

int main() {

   Best y = 3.14;
   Jest         z = 3.14;
   Test<double> x = 3.14;
 Yest<double> y = 3.14;
   Zest<double> z = 3.14;
}
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to