https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106366

            Bug ID: 106366
           Summary: CTAD fails to prioritize initializer_list when done
                    via Deduction guide and inherited CTORS
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: peter.cpp at sommerlad dot ch
  Target Milestone: ---

The following code fails to compile on trunk, 12.1 and all 11 versions of g++ I
tried and compiles fine with clang and msvc:

#include <vector>
template<typename T>
struct Adapter: std::vector<T>{
    using std::vector<T>::vector;
    // Adapter(std::initializer_list<T> l)
    // :std::vector<T>::vector(l){}
};
template<typename T>
Adapter(std::initializer_list<T>) -> Adapter<T>;

int main(){
    Adapter x{1,2,3};
}

see https://compiler-explorer.com/z/hj9zPPa8d

defining the constructor instead of the (not yet inherited) deduction guide
makes it work.

Reply via email to