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: unassignedclangb...@nondot.org
          Reporter: et...@ethanhs.me
                CC: llvm-bugs@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to