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

            Bug ID: 50644
           Summary: User-defined literals generate false-positive
                    "Wreserved-identifier"
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++11
          Assignee: unassignedclangb...@nondot.org
          Reporter: al42...@al42and.me
                CC: blitzrak...@gmail.com, dgre...@apple.com,
                    erik.pilking...@gmail.com, llvm-bugs@lists.llvm.org,
                    richard-l...@metafoo.co.uk

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
https://en.cppreference.com/w/cpp/language/user_literal, 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 (https://github.com/llvm/llvm-project.git
206a66de5902b2b6dc0c62c4a25526d7e7f24186)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /tmp/./llvm-project/build/bin

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to