[llvm-bugs] [Bug 27801] New: [PCH] Moving sources that use 'pragma once' to another directory causes redefinition errors.
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed May 18 02:03:20 PDT 2016
https://llvm.org/bugs/show_bug.cgi?id=27801
Bug ID: 27801
Summary: [PCH] Moving sources that use 'pragma once' to another
directory causes redefinition errors.
Product: clang
Version: trunk
Hardware: PC
OS: Windows NT
Status: NEW
Severity: normal
Priority: P
Component: Frontend
Assignee: unassignedclangbugs at nondot.org
Reporter: pierregousseau14 at gmail.com
CC: llvm-bugs at lists.llvm.org
Classification: Unclassified
A redefinition error is emitted with the following sequence of commands. No
errors if using a header guard instead of #pragma once.
f.h:
#pragma once
int f() {return 0;}
header.h:
#include "f.h"
g.cpp:
#include "f.h"
int g() { return f();}
$ clang++ --version
clang version 3.9.0 (http://llvm.org/git/clang.git
fd7431291bd2bcd4ea3b768d5eff7098dd22266f)
$ clang++ -x c++-header header.h -o header.h.pch
$ mkdir sub_dir
$ cp f.h header.h header.h.pch g.cpp sub_dir
$ clang++ -c g.cpp -include-pch header.h.pch
In file included from g.cpp:1:
./f.h:6:5: error: redefinition of 'f'
int f() {return 0;}
^
/home/pierre/lab/f.h:6:5: note: previous definition is here
int f() {return 0;}
--
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/20160518/6d4c0969/attachment.html>
More information about the llvm-bugs
mailing list