From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26136 invoked by alias); 25 Jun 2014 04:21:35 -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 26088 invoked by uid 48); 25 Jun 2014 04:21:29 -0000 From: "rs2740 at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/60009] g++ allows copy-initialization of an array of class type from a non-braced string literal Date: Wed, 25 Jun 2014 04:21:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 4.8.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: rs2740 at gmail dot com 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: cc Message-ID: In-Reply-To: References: 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-06/txt/msg01918.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60009 TC changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |rs2740 at gmail dot com --- Comment #1 from TC --- http://stackoverflow.com/questions/24378882/weird-gcc-array-initialization-behavior appears to be related. Minimal example: struct A { A() { } }; int main() { A a[10] = A(); } Compiles with GCC 4.6, 4.7, 4.8 and 4.9, in both C++98 and C++11 modes, even though it shouldn't. However, struct A { }; int main() { A a[10] = A(); } does not compile in any of the GCC versions tested. struct A { A() = default; }; int main() { A a[10] = A(); } Compiles with GCC 4.9 in C++11 mode; does not compile with 4.6-4.8 in C++ 11 mode, however.