[cfe-dev] [libc++] Conflict between "_UI" template parameter and Windows tchar.h macro

Eric Fiselier via cfe-dev cfe-dev at lists.llvm.org
Wed May 31 14:21:58 PDT 2017


Very annoying indeed.

Fixed in r304348. I also asked some Windows STL devs is there are other
macros we need to look out for.

/Eric

On Wed, May 31, 2017 at 2:18 PM, Reid Kleckner <rnk at google.com> wrote:

> That is annoying, but it seems like something that we probably should work
> around in libc++.
>
>
> On Mon, May 29, 2017 at 7:45 PM, Orivej Desh via cfe-dev <
> cfe-dev at lists.llvm.org> wrote:
>
>> At present `algorithm' and `random' can not be included after `tchar.h'
>> [1]
>> because it contains
>>
>>      #define _UI     unsigned int
>>
>> and the former contain templates like
>>
>>      template <class _UI, _UI _Xp> struct __log2
>>
>> that fail to compile with
>>
>>      algorithm:2807: error C2332: 'class': missing tag name
>>      algorithm:2807: error C2628: '<unnamed-tag>' followed by 'unsigned'
>> is illegal (did you forget a ';'?)
>>      algorithm:2807: error C2628: '<unnamed-tag>' followed by 'int' is
>> illegal (did you forget a ';'?)
>>      algorithm:2807: error C2993: '': illegal type for non-type template
>> parameter '<unnamed-tag>'
>>
>> This affects compilation of open source libraries, in particular this
>> BDB file [2] fails to compile because it includes tchar.h [3] before C++
>> STL.  What is the best way to resolve this?  May libc++ rename or
>> undefine `_UI'?
>>
>> [1] This one is from the old vc6 crt library, but Visual Studio 2017
>>     installs crt with the same macros:
>>     https://github.com/weolar/miniblink49/blob/f3ffb1ee/vc6/incl
>> ude/crt/tchar.h#L838
>> [2] https://github.com/berkeleydb/libdb/blob/master/lang/cxx/cxx_seq.cpp
>> [3] https://github.com/berkeleydb/libdb/blob/master/src/dbinc/wi
>> n_db.h#L33
>> _______________________________________________
>> cfe-dev mailing list
>> cfe-dev at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20170531/40a3e994/attachment.html>


More information about the cfe-dev mailing list