<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 - attribute ignored is a warning with gcc, an error with clang"
href="https://bugs.llvm.org/show_bug.cgi?id=34304">34304</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>attribute ignored is a warning with gcc, an error with clang
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>5.0
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</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>Frontend
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>sylvestre@debian.org
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>This impacts a lot of qt programs:
<a href="http://clang.debian.net/status.php?version=5.0&key=NO_DISCARD_ATTRIBUTE">http://clang.debian.net/status.php?version=5.0&key=NO_DISCARD_ATTRIBUTE</a>
Simple example:
int a [[]];
int & [[nodiscard]] b = a;
$ clang++ -std=c++11 -c foo.cpp
foo.cpp:2:9: error: 'nodiscard' attribute cannot be applied to types
int & [[nodiscard]] b = a;
^
1 error generated.
$ g++ -std=c++11 -c foo.cpp
foo.cpp:2:20: warning: attribute ignored [-Wattributes]
int & [[nodiscard]] b = a;
^
foo.cpp:2:20: note: an attribute that appertains to a type-specifier is ignored
As we see clang as a drop-in replacement of gcc, maybe we should not trigger an
error here.</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>