Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.

STLport build error

Marián__VooDooMan__M
New Contributor II
683 Views

Greetings,

Env: Win 8.1 x64, MSVC 2013, ICC 14 (latest up-to-date), but the issue is manifesting on beta ICC 15 as well.

I get this error for this code:

namespace detail {

template <class _Tp, class... _Args>
struct __is_constructible
{
  private:
    template <class _Up, class... _UpArgs>
    static typename remove_reference<decltype(_Up( declval<_UpArgs>()... ), declval<true_type>())>::type __test(int);

    template <class, class...>
    static false_type __test(...);    
  public:
#ifdef _STLP_STATIC_CONST_INIT_BUG
    static const bool __value;
#else
    static const bool __value = is_same<decltype(__test<_Tp, _Args...>(0)),true_type>::value;
#endif
};

} // namespace detail

--- snip---

1>stlport\type_traits(908): error : expected an identifier
1>        public integral_constant<bool, detail::__is_constructible<_Tp,_Args...>::__value>
1>                                               ^

"__is_constructible" is indeed in its own namespace scope ("detail"). But when I change struct name to e.g. "__is_constructibleX" it compiles fine.

IMHO there is some problem with namespace resolution in ICC 14 & 15.

PS: did anyone reading this have successful build of STLport at MSVC 2013 && ICC 14/15 ? Any advice is very welcome!

0 Kudos
1 Solution
Judith_W_Intel
Employee
683 Views

 

No but all identifiers that start with two underscores or an underscore followed by a capital letter are reserved to the implementation.

In this case the STLPort library implementation is using the same reserved identifier that recent versions of the Microsoft compiler have started using.

http://en.cppreference.com/w/cpp/keyword

Judy

View solution in original post

0 Kudos
6 Replies
Judith_W_Intel
Employee
683 Views

 

MSVC++ 2013 (and Intel) have implemented the __is_constructible compiler hook to implement the std::is_constructible type trait (i.e. __is_constructible is a built-in keyword). Thus an implementation cannot reuse it as an identifier.

See:http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20131209/095417.html

Actually I'm surprised you're not seeing an error on the declaration of the struct, i.e.:

!% cat p.cpp

struct __is_constructible {};

!% cl -c p.cpp
Microsoft (R) C/C++ Optimizing Compiler Version 18.00.21005.1 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

p.cpp
p.cpp(2) : error C2332: 'struct' : missing tag name
p.cpp(2) : error C2143: syntax error : missing ';' before '__is_constructible'
p.cpp(2) : error C2059: syntax error : '__is_constructible'
p.cpp(2) : error C2143: syntax error : missing ';' before '{'
p.cpp(2) : error C2447: '{' : missing function header (old-style formal list?)

Judy

0 Kudos
Marián__VooDooMan__M
New Contributor II
683 Views

Greetings,

As I am beta-tester of ICC 15, at premier support Reddy told me that it seems to be a built-in keyword which cannot be used as an identifier.

Is there some URL with a full list of internal keywords? I did some googling, but I did not find such list.

TIA!

0 Kudos
Judith_W_Intel
Employee
684 Views

 

No but all identifiers that start with two underscores or an underscore followed by a capital letter are reserved to the implementation.

In this case the STLPort library implementation is using the same reserved identifier that recent versions of the Microsoft compiler have started using.

http://en.cppreference.com/w/cpp/keyword

Judy

0 Kudos
Marián__VooDooMan__M
New Contributor II
683 Views

Judith Ward (Intel) wrote:

No but all identifiers that start with two underscores or an underscore followed by a capital letter are reserved to the implementation.

Yes, I am aware of that, but there is no capital letter after 2 underscores.

0 Kudos
Judith_W_Intel
Employee
683 Views

 

I don't think you read the rules correctly:

> Also, each name that contains a double underscore __ or begins with an underscore followed by an uppercase letter is always reserved to the > implementation and should not be used as an identifier.

Notice the "or". Any name that begins with a double underscore is reserved no matter what comes after it. Also any name that with a single underscore followed by a capital letter is reserved.

Judy

 

0 Kudos
Marián__VooDooMan__M
New Contributor II
683 Views

Oh, you are right. Thank you.

0 Kudos
Reply