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

            Bug ID: 68525
           Summary: bogus use of deleted function error on a template with
                    a flexible array member
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: msebor at gcc dot gnu.org
  Target Milestone: ---

Recent trunk gets confused by the program below into issuing a rather
mysterious error.  Both Clang and Gcc 5.1 compile the code without an error.

$ cat z.cpp && /build/gcc-trunk-svn/gcc/xgcc -B /build/gcc-trunk-svn/gcc -Wall
-Wextra -Wpedantic -O2  -S -o/dev/tty -xc++ z.cpp
template <class T>
struct A {
    int n;
    T a[];
};

struct B { B (int); };

A<B> ab;
        .file   "z.cpp"
z.cpp:4:9: warning: ISO C++ forbids zero-size array ‘a’ [-Wpedantic]
     T a[];
         ^

z.cpp:9:6: error: use of deleted function ‘A<B>::A()’
 A<B> ab;
      ^~

z.cpp:2:8: note: ‘A<B>::A()’ is implicitly deleted because the default
definition would be ill-formed:
 struct A {
        ^

z.cpp:2:8: error: no matching function for call to ‘B::B()’
z.cpp:7:12: note: candidate: B::B(int)
 struct B { B (int); };
            ^

z.cpp:7:12: note:   candidate expects 1 argument, 0 provided
z.cpp:7:8: note: candidate: constexpr B::B(const B&)
 struct B { B (int); };
        ^

z.cpp:7:8: note:   candidate expects 1 argument, 0 provided
z.cpp:7:8: note: candidate: constexpr B::B(B&&)
z.cpp:7:8: note:   candidate expects 1 argument, 0 provided

Reply via email to