[LLVMbugs] [Bug 21624] New: -fmodules causes failure of inclusion of STL headers

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Nov 20 22:54:35 PST 2014


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

            Bug ID: 21624
           Summary: -fmodules causes failure of inclusion of STL headers
           Product: clang
           Version: trunk
          Hardware: PC
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: 191919 at gmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

clang version 3.6.0 (trunk 222503) failed to compile trivial code that includes
STL header when using -fmodule:

The code:

```
#include <vector>

int main() {}
```

Compile it with:


```
$ /opt/bin/clang++ -fmodules -c -o m mm.cpp    
```

clang gave the following error messages:

```
While building module 'std' imported from mm.cpp:1:
In file included from <module-includes>:4:
In file included from /usr/include/c++/v1/ccomplex:21:
In file included from /usr/include/c++/v1/complex:247:
In file included from /usr/include/c++/v1/sstream:174:
In file included from /usr/include/c++/v1/ostream:140:
/usr/include/c++/v1/locale:873:26: error: use of undeclared identifier
'strtoll_l'; did you mean 'wcstoll_l'?
        long long __ll = strtoll_l(__a, &__p2, __base, _LIBCPP_GET_C_LOCALE);
                         ^
/usr/include/xlocale/_wchar.h:98:2: note: 'wcstoll_l' declared here
        wcstoll_l(const wchar_t * __restrict, wchar_t ** __restrict, int,
        ^
While building module 'std' imported from mm.cpp:1:
In file included from <module-includes>:4:
In file included from /usr/include/c++/v1/ccomplex:21:
In file included from /usr/include/c++/v1/complex:247:
In file included from /usr/include/c++/v1/sstream:174:
In file included from /usr/include/c++/v1/ostream:140:
/usr/include/c++/v1/locale:873:36: error: cannot initialize a parameter of type
'const wchar_t *' with an lvalue of type 'const char *'
        long long __ll = strtoll_l(__a, &__p2, __base, _LIBCPP_GET_C_LOCALE);
                                   ^~~
/usr/include/xlocale/_wchar.h:98:38: note: passing argument to parameter here
        wcstoll_l(const wchar_t * __restrict, wchar_t ** __restrict, int,
                                            ^
While building module 'std' imported from mm.cpp:1:
In file included from <module-includes>:4:
In file included from /usr/include/c++/v1/ccomplex:21:
In file included from /usr/include/c++/v1/complex:247:
In file included from /usr/include/c++/v1/sstream:174:
In file included from /usr/include/c++/v1/ostream:140:
/usr/include/c++/v1/locale:913:35: error: use of undeclared identifier
'strtoull_l'; did you mean 'wcstoull_l'?
        unsigned long long __ll = strtoull_l(__a, &__p2, __base,
_LIBCPP_GET_C_LOCALE);
                                  ^
/usr/include/xlocale/_wchar.h:101:2: note: 'wcstoull_l' declared here
        wcstoull_l(const wchar_t * __restrict, wchar_t ** __restrict, int,
        ^
While building module 'std' imported from mm.cpp:1:
In file included from <module-includes>:4:
In file included from /usr/include/c++/v1/ccomplex:21:
In file included from /usr/include/c++/v1/complex:247:
In file included from /usr/include/c++/v1/sstream:174:
In file included from /usr/include/c++/v1/ostream:140:
/usr/include/c++/v1/locale:913:46: error: cannot initialize a parameter of type
'const wchar_t *' with an lvalue of type 'const char *'
        unsigned long long __ll = strtoull_l(__a, &__p2, __base,
_LIBCPP_GET_C_LOCALE);
                                             ^~~
/usr/include/xlocale/_wchar.h:101:39: note: passing argument to parameter here
        wcstoull_l(const wchar_t * __restrict, wchar_t ** __restrict, int,
                                             ^
While building module 'std' imported from mm.cpp:1:
In file included from <module-includes>:4:
In file included from /usr/include/c++/v1/ccomplex:21:
In file included from /usr/include/c++/v1/complex:247:
In file included from /usr/include/c++/v1/sstream:174:
In file included from /usr/include/c++/v1/ostream:140:
/usr/include/c++/v1/locale:943:28: error: use of undeclared identifier
'strtold_l'
        long double __ld = strtold_l(__a, &__p2, _LIBCPP_GET_C_LOCALE);
                           ^
mm.cpp:1:10: fatal error: could not build module 'std'
#include <vector>
 ~~~~~~~~^
6 errors generated.
```

Xcode's stock clang (Apple LLVM version 6.0 (clang-600.0.54) (based on LLVM
3.5svn)) is ok with `-fmodules`.

-- 
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/20141121/d901dab3/attachment.html>


More information about the llvm-bugs mailing list