[Bug c++/100979] New: Nested CTAD fails when the outer object is direct initialized and the inner object is list initialized

brycelelbach at gmail dot com gcc-bugzilla@gcc.gnu.org
Tue Jun 8 22:45:49 GMT 2021


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

            Bug ID: 100979
           Summary: Nested CTAD fails when the outer object is direct
                    initialized and the inner object is list initialized
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: brycelelbach at gmail dot com
  Target Milestone: ---

template <typename T> struct X { X(T t) {} };

int main() {
  auto t00 = X(1);
  auto t01 = X{1};
  X t02{1};
  X t03(1);

  auto t04 = X(X{1});
  auto t05 = X{X{1}};
  auto t06 = X(X(1));
  auto t07 = X{X(1)};
  X t08(X{1}); // GCC 11.x and up rejects this; MSVC and Clang accept it.
  X t09{X{1}};
  X t10(X(1));
  X t11{X(1)};
}

https://godbolt.org/z/Pbx6cjE7q


More information about the Gcc-bugs mailing list