[llvm-bugs] [Bug 40810] New: [Frontend] Emit a warning diagnostic for attributes that are ignored.

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Feb 21 15:02:33 PST 2019


https://bugs.llvm.org/show_bug.cgi?id=40810

            Bug ID: 40810
           Summary: [Frontend] Emit a warning diagnostic for attributes
                    that are ignored.
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: matthew.davis at sony.com
                CC: blitzrakete at gmail.com, dgregor at apple.com,
                    erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
                    richard-llvm at metafoo.co.uk

Clang has a handful of IgnoredAttribute diagnostics, controlled by the option
'-Wignored-attributes'  However, clang does not warn on certain cases that
could be helpful to developers.  For instance, it might be useful to extend
this warning to template type arguments that have attributes that are ignored. 
For example, the 'aligned' attribute is silently dropped in the following:

   //  clang++ ex.cc -fsyntax-only -Wignored-attributes
   typedef int type1 __attribute__((aligned(16)));

   template <typename T>
   struct S {
     static const auto value = alignof(T);
   };

   static_assert(S<type1>::value == 16, "Unexpected alignment for S<type1>");

In this case, g++ will emit the following warning:
"ignoring attributes on template argument ‘type1 {aka int}’
[-Wignored-attributes]"

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190221/830634e7/attachment.html>


More information about the llvm-bugs mailing list