https://llvm.org/bugs/show_bug.cgi?id=24387
Bug ID: 24387
Summary: Precompiled headers don't work with `#pragma once`
Product: clang
Version: 3.6
Hardware: PC
OS: All
Status: NEW
Severity: normal
Priority: P
Component: -New Bugs
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected]
Classification: Unclassified
#pragma once information isn't stored in precompiled headers. This makes PCH
useless for projects that use #pragma once as the only form of header guard.
Test case:
a.h:
#pragma once
static int x = 3;
a.c:
#include "a.h"
int main(void) { return 0; }
then:
$ clang a.c -o a
$ clang a.h -o a.h.pch
a.h:1:9: warning: #pragma once in main file
#pragma once
^
1 warning generated.
$ clang -include-pch a.h.pch a.c -o a
In file included from a.c:1:
./a.h:3:12: error: redefinition of 'x'
static int x = 3;
^
./a.h:3:12: note: previous definition is here
static int x = 3;
^
1 error generated.
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs