[LLVMbugs] [Bug 17361] New: On Windows, #include and __has_include fails to find files when device name is not present. maybe path library is at fault.

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Sep 25 08:28:04 PDT 2013


http://llvm.org/bugs/show_bug.cgi?id=17361

            Bug ID: 17361
           Summary: On Windows, #include and __has_include fails to find
                    files when device name is not present. maybe path
                    library is at fault.
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: gmisocpp at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

To reproduce:
* On WINDOWS (important), create a directory named c:\test (use that name)
* Create test.h in the test directory containing the comment /* test */
* In c:\test, create the file test.cpp and copy this program into it:

#define AFILE "\test\test.h"

#if defined(__clang__)
#if __has_include( AFILE )
#warning "appears to have test.h"
#else
#warning "appears not to have test.h"
#endif
#endif

#include AFILE

int main()
{
}

* Then compile. Results are:

c:\test>clang++ test.cpp
test.cpp:7:2: warning: "appears not to have test.h" [-W#warnings]
#warning "appears not to have test.h"
 ^
test.cpp:11:10: fatal error: '\test\test.h' file not found
#include AFILE
         ^
test.cpp:1:15: note: expanded from macro 'AFILE'
#define AFILE "\test\test.h"
              ^
1 warning and 1 error generated.

c:\test>g++ test.cpp

c:\test>


* Note how clang++ fails to find the file. If the AFILE macro is changed to
include a drive, i.e. c:\test\test.h, the file will be found.

* Note how g++ works either way.

Conclusion: clang has a bug. Possibly in it's path library
c:\llvm\lib\Support\path.cpp or .inc or .h at a guess because __has_include and
#include are both similarly affected.

-- 
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/20130925/121900dc/attachment.html>


More information about the llvm-bugs mailing list