[llvm-bugs] [Bug 24387] New: Precompiled headers don't work with `#pragma once`
via llvm-bugs
llvm-bugs at lists.llvm.org
Thu Aug 6 14:51:55 PDT 2015
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: unassignedclangbugs at nondot.org
Reporter: hitchmanr at gmail.com
CC: llvm-bugs at lists.llvm.org
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150806/98597d2d/attachment.html>
More information about the llvm-bugs
mailing list