[cfe-dev] New C++0x feature support in Clang

John Bytheway jbytheway+llvm at gmail.com
Fri Feb 4 14:03:31 PST 2011


On 03/02/11 23:16, Douglas Gregor wrote:
> On Feb 3, 2011, at 3:07 PM, John Bytheway wrote:
>> On 31/01/11 16:15, Douglas Gregor wrote:
<snip>
>> Here are a few extracts from one attempted compilation as examples:
>>
>> /usr/lib/gcc/x86_64-pc-linux-gnu/4.4.5/include/g++-v4/exception_ptr.h:143:13:
>> error: unknown type name 'type_info'
>>      const type_info*
>>            ^
> 
> I'm guessing that this is actually a GCC bug; did they forget to include
> <typeinfo>?

It's more complicated than that.  This is in a header which is included
from <typeinfo> before the definition of class type_info, so it's really
a cyclic dependency problem.  It can be worked around in user code by
adding "namespace std { class type_info; }" before including standard
headers.  But, if you wish to be bug-compatible with g++ 4.4 then you
will have to do something a bit more.  Is that likely to happen?

>> /usr/lib/gcc/x86_64-pc-linux-gnu/4.4.5/include/g++-v4/ext/string_conversions.h:40:60:
>> error: template parameter missing a default argument
>>  template<typename _TRet, typename _Ret = _TRet, typename _CharT,
>>                                                           ^
> 
> If this is a function template, then it's a Clang bug.

Now fixed, as you said in your other message.  :)

>> /usr/lib/gcc/x86_64-pc-linux-gnu/4.4.5/include/g++-v4/bits/basic_string.h:2570:12:
>> error: no matching function for call to '__stoa'
>>  { return __gnu_cxx::__stoa(&std::strtol, "stol", __str.c_str(),
>>           ^~~~~~~~~~~~~~~~~

This fixed itself because __stoa was in fact the function template with
the above bug.

>> /usr/lib/gcc/x86_64-pc-linux-gnu/4.4.5/include/g++-v4/tr1_impl/cmath:322:12:
>> error: use of undeclared identifier '__builtin_acoshf'
>>  { return __builtin_acoshf(__x); }
>>           ^
> 
> More missing built-ins, apparently. It'd be good to file a bug about this.

It's actually 53 built-ins :(.  Bug filed at

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

>> clang: SemaCXXCast.cpp:612: TryCastResult TryStaticCast(clang::Sema&,
>> clang::Expr*&, clang::QualType, bool, const clang::SourceRange&,
>> unsigned int&, clang::CastKind&, clang::CXXCastPath&): Assertion
>> `SrcType->getAs<EnumType>()->getDecl()->isScoped()' failed.
> 
> Can you identify the problematic code here and file a bug?

I'll have a go now.

John




More information about the cfe-dev mailing list