<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 - User-defined literals generate false-positive "Wreserved-identifier""
href="https://bugs.llvm.org/show_bug.cgi?id=50644">50644</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>User-defined literals generate false-positive "Wreserved-identifier"
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</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>C++11
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>al42and@al42and.me
</td>
</tr>
<tr>
<th>CC</th>
<td>blitzrakete@gmail.com, dgregor@apple.com, erik.pilkington@gmail.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk
</td>
</tr></table>
<p>
<div>
<pre>The C++11 standard requires user-defined suffixes to begin with the underscore.
However they seem to be considered reserved by Clang.
The following code, based on an example from
<a href="https://en.cppreference.com/w/cpp/language/user_literal">https://en.cppreference.com/w/cpp/language/user_literal</a>, seems to erroneously
trigger the warning with the most recent commit of clang:
$ cat test.cpp
#include <string>
void operator "" _km(long double);
int main() { return 0; }
$ ./llvm-project/build/bin/clang -Wreserved-identifier -std=c++11 test.cpp
test.cpp:3:6: warning: identifier 'operator""_km' is reserved because it starts
with '_' at global scope [-Wreserved-identifier]
void operator "" _km(long double);
^
1 warning generated.
$ ./llvm-project/build/bin/clang --version
clang version 13.0.0 (<a href="https://github.com/llvm/llvm-project.git">https://github.com/llvm/llvm-project.git</a>
206a66de5902b2b6dc0c62c4a25526d7e7f24186)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /tmp/./llvm-project/build/bin</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>