This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/82893] Bad diagnostic on negative sized array


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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |diagnostic
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2017-11-08
                 CC|                            |msebor at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> ---
Thanks for the report.  I agree that the error could stand to be improved to be
more informative so I confirm the request.

Intel ICC prints the following:

prog.cc(10): error: array is too large
      char pad[8 - sizeof(T)];
           ^
          detected during instantiation of class "Baz<T> [with T=Bar]" at line
15
prog.cc(15): error: static assertion failed with ""
      static_assert(sizeof(Baz<Bar>) == 8, "");
      ^

and Visual C++:

prog.cc(10): error C2118: negative subscript
prog.cc(15): note: see reference to class template instantiation 'Baz<Bar>'
being compiled
prog.cc(15): error C2338: 

(though I'm not sure what the second error is all about).

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]