-
Notifications
You must be signed in to change notification settings - Fork 15.3k
Open
Labels
clang:diagnosticsNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerclang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"diverges-from:gccDoes the clang frontend diverge from gcc on this issueDoes the clang frontend diverge from gcc on this issue
Description
Source code and error message
Error message was reported by clang++ when compiling below source code:
#include <stdint.h>
class CLangTester {
public:
uint8_t test();
};
uint8_t ::CLangTester::test() {
return 23;
}
int main() {
CLangTester tester;
tester.test();
return 0;
}
Error message:
/usr/bin/clang++ -c -I/usr/local/include -I. -Wall -g -std=c++14 namespace.cpp -o build/namespace.o
namespace.cpp:21:1: error: 'uint8_t' (aka 'unsigned char') is not a class, namespace, or enumeration
uint8_t ::CLangTester::test() {
^
1 error generated.
make: *** [Makefile:28: build/namespace.o] Error 1
Passed when using g++
g++ -c -I/usr/local/include -I. -Wall -g -std=c++14 namespace.cpp -o build/namespace.o
g++ build/namespace.o -L/usr/local/lib -L/usr/lib -lrt -pthread -Wl,-rpath-link,/usr/lib,-rpath-link,/usr/local/lib -o clang-namespace
Version info
clang --version output:
clang version 10.0.0-4ubuntu1
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Additional info
The error disappears when I changed
uint8_t ::CLangTester::test() {
to
uint8_t CLangTester::test() {
Apparently the clang++ ignored the space between uint8_t and ::, while ::ClangTester is totally valid.
Metadata
Metadata
Assignees
Labels
clang:diagnosticsNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerclang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"diverges-from:gccDoes the clang frontend diverge from gcc on this issueDoes the clang frontend diverge from gcc on this issue