From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21134 invoked by alias); 15 Feb 2014 12:46:27 -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 21104 invoked by uid 48); 15 Feb 2014 12:46:23 -0000 From: "ali.baharev at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/60212] New: no warning for unused variables Date: Sat, 15 Feb 2014 12:46: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: normal X-Bugzilla-Who: ali.baharev 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: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter attachments.created 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-02/txt/msg01395.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60212 Bug ID: 60212 Summary: no warning for unused variables Product: gcc Version: 4.8.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: ali.baharev at gmail dot com Created attachment 32144 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=32144&action=edit source file needed to reproduce the bug report After reading the documentation, I would expect a warning that x is unused, and both clang and msvc gives a warning too. g++ -fwhole-program -O3 -std=c++11 -Wall -Wextra -Wunused warn.cpp struct S { int array[1024]; }; int main() { const S a{{0}}; S x(a); } In my opinion, it is NOT a duplicate of: No unused warning for variables of non-trivial types http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55203 I see no reason for tagging S with attribute warn_unused; the compiler should be able to verify unused S variables even without it.