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

            Bug ID: 82270
           Summary: incorrect warning [-Wignored-attributes]
           Product: gcc
           Version: 6.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: paul.groke at dynatrace dot com
  Target Milestone: ---

Created attachment 42210
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=42210&action=edit
Reproducer

GCC version 6.4, SPARC 32 and 64 bit
System: Solaris
No command line options, i.e. just
g++ test.cpp

Compiler output is:

test.cpp: In function 'int main()':
test.cpp:19:21: warning: ignoring attributes on template argument 'type {aka
type_fn<8u>}' [-Wignored-attributes]
  return meta_fn<type>::value;
                     ^

The following versions also emit the same incorrect warning:
GCC version 6.3, ARM (but not ARM64)
GCC version 6.2.1, MSP430

I haven't been able to reproduce the warning with any x86 compiler though -
i.e. GCC 6.4 on Linux x86 doesn't emit the warning.

If I understand this correctly, the warning is incorrect. The attribute is
attached directly to the type (the struct), and thus must not be "lost" if
using the type as a template argument.

---

The following code also produces the same warning (tested with Boost 1.63,
1.64):

#include <boost/container/small_vector.hpp>

int main()
{
    boost::container::small_vector<short, 2> v;
}

Reply via email to