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

            Bug ID: 100742
           Summary: False positive -Wignored-attributes with std::map and
                    aligned(8) attribute
           Product: gcc
           Version: 9.3.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: liavonlida at gmail dot com
  Target Milestone: ---

Check following code:
////////////////////////////////////////////////////
#include <map>

template <typename Type>
class VecBase
{
    typedef __attribute__((aligned(8))) Type value_data;
};

typedef std::map<double, double> test_passed;

struct S1
{
  inline void f1(VecBase<const double> p1) {}
};

typedef std::map<double, double> test_failed;

int main()
{
  return 0;
}
////////////////////////////////////////////////////

This leads to -Wignored-attributes warning:

<source>:16:32: warning: ignoring attributes on template argument 'const
double' [-Wignored-attributes]
   16 | typedef std::map<double, double> test_failed;
      |         

This looks very strange and false positive. 
Could be reproduced with GCC from 6 to 10 versions. GCC 11 is ok with this
code. Other compilers are also ok. I tried on https://godbolt.org/.

Reply via email to