[Bug c++/68525] [6 Regression] bogus use of deleted function error on a template with a flexible array member

msebor at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Jan 6 00:52:00 GMT 2016


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

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |INVALID

--- Comment #2 from Martin Sebor <msebor at gcc dot gnu.org> ---
Actually, I see that 5.1 accepts the code in C++ 98 mode but rejects it in C++
11 mode.  Clang behaves the same way.  Probably due to a change to the
standard.

In hindsight I agree that the test case is invalid.  I even made that point
recently in a review of a patch submitted to make it valid (forgetting I had
previously raised this bug):
https://gcc.gnu.org/ml/gcc-patches/2016-01/msg00055.html

Unfortunately, there is a bug here that makes GCC accept the following
(equivalent and also invalid) code:

cat x.cpp && ~/bin/gcc-5.1.0/bin/g++ x.cpp -c -std=c++11
template <class T>
struct A {
    int n;
    T a[];
    A (): n (), a () { }
};

struct B { B (int); };

A<B> ab;

A few days ago I submitted bug 69127 for a similar problem with zero-length
arrays.  I suppose that bug could be used to fix this problem as well, even
though it's about flexible array members.

Let me close this bug as INVALID.


More information about the Gcc-bugs mailing list