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.

Reply via email to