<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [[gnu::init_priority(N)]] generates "unknown attribute" warning while __attribute__((init_priority(N))) works"
   href="https://bugs.llvm.org/show_bug.cgi?id=32993">32993</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[[gnu::init_priority(N)]] generates "unknown attribute" warning while __attribute__((init_priority(N))) works
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>4.0
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>C++
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>romain.geissler@amadeus.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dgregor@apple.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Hi,

The following snippet (built with -std=gnu++14) will yield a "unknown
attribute" warning:

struct A{};

A A1 [[gnu::init_priority(1000)]]; // warning generated here
A A2 __attribute__((init_priority(1000))); // no warning here


<source>:3:8: warning: unknown attribute 'init_priority' ignored
[-Wunknown-attributes]
A A1 [[gnu::init_priority(1000)]];
       ^
1 warning generated.

According to the documentation here
<a href="https://clang.llvm.org/docs/LanguageExtensions.html#non-standard-c-11-attributes">https://clang.llvm.org/docs/LanguageExtensions.html#non-standard-c-11-attributes</a>
[[gnu::init_priority(1000)]] should be an alias for
__attribute__((init_priority(1000))), but it doesn't seem to be the case.

Tested on clang 4.0. See here <a href="https://godbolt.org/g/xvqO1z">https://godbolt.org/g/xvqO1z</a>

Cheers,
Romain</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>