From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24526 invoked by alias); 20 May 2014 18:40:59 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 24497 invoked by uid 48); 20 May 2014 18:40:55 -0000 From: "bugs at qult dot net" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/61259] New: Spurious "ISO C++ forbids zero-size array" warning with -pedantic Date: Tue, 20 May 2014 18:40:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 4.8.2 X-Bugzilla-Keywords: X-Bugzilla-Severity: minor X-Bugzilla-Who: bugs at qult dot net X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-05/txt/msg01760.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61259 Bug ID: 61259 Summary: Spurious "ISO C++ forbids zero-size array" warning with -pedantic Product: gcc Version: 4.8.2 Status: UNCONFIRMED Severity: minor Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: bugs at qult dot net The following code, when compiled with -pedantic, compiles properly but produces a warning about zero-sized array 'argv'. #include struct Foo { Foo(const char* s) : p(s) {} const char* p; }; int main(int, char* argv[]) { const char* s(Foo(argv[0]).p); std::cout << s << std::endl; return 0; } I understand that const char* s(Foo(argv[0])) is to be understood as being a declaration of function s taking an array of 0 Foo and returning a const char*, but with the '.p', apparently the compiler resolves the ambiguity by itself and the code does build an instance of Foo with argv[0] as an argument. So in any case, something's wrong: either this code should not compile or it should not issue the warning.