https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93259
Bug ID: 93259 Summary: Unsized temporary array initialization problem Product: gcc Version: 10.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: m.cencora at gmail dot com Target Milestone: --- using Array = int[]; auto && array = Array { 1, 2, 3 }; decltype(array) differs depending on if it is declared inside function, or function template. I.e. following program fails to compile: #include <type_traits> using Array = int[]; template <typename ...Ts> void bar1(Ts ...) { auto && array = Array{ 1, 2, 3 }; static_assert(std::is_same<int (&&)[3], decltype(array)>{}, ""); // this fails, deduces array as int (&&) [] } template <typename T> void bar2() { auto && array = Array{ 1, 2, 3 }; static_assert(std::is_same<int (&&)[3], decltype(array)>{}, ""); // this fails, deduces array as int (&&) [] } void bar3() { auto && array = Array{ 1, 2, 3 }; static_assert(std::is_same<int (&&)[3], decltype(array)>{}, ""); // OK } int main() { bar1<int>(1, 2, 3); bar2<int>(); bar3(); }