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

            Bug ID: 90938
           Summary: [9/10 Regression] Initializing array with {1} works,
                    but not {0}
           Product: gcc
           Version: 9.1.0
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: redi at gcc dot gnu.org
                CC: msebor at gcc dot gnu.org
  Target Milestone: ---

struct X {
  X() = delete;
  X(int) { }
};

X x[1] { 1 };  // OK
X y[1] { 0 };


arr.cc:7:12: error: use of deleted function 'X::X()'
    7 | X y[1] { 0 };
      |            ^
arr.cc:2:3: note: declared here
    2 |   X() = delete;
      |   ^


This started to be rejected by r270155:

   PR c++/89974 - ICE on a definition of a non-type specialization on a struct
object with pointer to member function
    PR c++/89878 - same specializations on a zero-initialized struct object as
a non-type parameter treated as distinct
    PR c++/89833 - sorry, unimplemented: string literal in function template
signature
    PR c++/47488 - sorry, unimplemented: string literal in function template
signature

    gcc/cp/ChangeLog:

            PR c++/89974
            PR c++/89878
            PR c++/89833
            PR c++/47488
            * decl.c (reshape_init_array_1): Strip trailing zero-initializers
            from arrays of trivial type and known size.
            * mangle.c (write_expression): Convert braced initializer lists
            to STRING_CSTs.
            (write_expression): Trim trailing zero-initializers from arrays
            of trivial type.
            (write_template_arg_literal): Mangle strings the same as braced
            initializer lists.

    gcc/testsuite/ChangeLog:

            PR c++/89974
            PR c++/89878
            PR c++/89833
            PR c++/47488
            * gcc/testsuite/g++.dg/abi/mangle69.C: New test.
            * gcc/testsuite/g++.dg/abi/mangle70.C: New test.
            * gcc/testsuite/g++.dg/abi/mangle71.C: New test.
            * gcc/testsuite/g++.dg/abi/mangle72.C: New test.
            * gcc/testsuite/g++.dg/cpp0x/constexpr-array19.C: New test.
            * gcc/testsuite/g++.dg/cpp2a/nontype-class15.C: New test.
            * gcc/testsuite/g++.dg/cpp2a/nontype-class16.C: New test.
            * gcc/testsuite/g++.dg/init/array51.C: New test.

Reply via email to