[llvm-bugs] [Bug 37529] New: Invalid "conflicting types for" in header
via llvm-bugs
llvm-bugs at lists.llvm.org
Sat May 19 01:02:46 PDT 2018
https://bugs.llvm.org/show_bug.cgi?id=37529
Bug ID: 37529
Summary: Invalid "conflicting types for" in header
Product: clang
Version: trunk
Hardware: PC
OS: Windows NT
Status: NEW
Severity: normal
Priority: P
Component: -New Bugs
Assignee: unassignedclangbugs at nondot.org
Reporter: ethan at ethanhs.me
CC: llvm-bugs at lists.llvm.org
I'm working on porting CPython to work with clang-cl on Windows, so first off
thank you for clang-cl!
I've recently hit an edge case which MSC will compile, but clang will refuse to
compile.
Here is a minimal example that shows the issue:
// example.h
float difference(struct timeval *start, struct timeval *end);
// example.c
#include "example.h"
#include <windows.h>
float difference(struct timeval *start, struct timeval *end) {
return end->tv_sec - start->tv_sec;
}
Clang will report "conflicting types for 'difference'" which seems to be due to
the fact it assumes struct timeval in example.h references a new struct, which
is wrong.
I'd normally just move the include of Windows.h into example.h as a work
around, but this isn't always practical. In CPython, the real file is pytime.h,
which is included in Python.h, which is included in just about everthing...
I believe it isn't too uncommon for this pattern to exist, so it'd be great if
it were supported. Thanks!
--
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/20180519/2ecdf384/attachment.html>
More information about the llvm-bugs
mailing list