clang bug under c++11?

Can anyone tell me where to direct bugs in the Apple clang compiler?  I hav=
e a short C++ program that clang fails to compile properly, but G++ compile=
s fine.

If such a bug can be posted in this group, here are the details:

This 15-line program fails to compile using clang under C++11 with clang's =
new library:
    #include <map>
    using std::map;
    template<typename K>
    struct Templ8 {
        struct Member {
            typename map<K,Member*>::iterator it;
        typedef typename map<K,Member*>::iterator iterator_type;
    int main() {
        Templ8<int> test;

This is the command-line:
    clang++ -stdlib=3Dlibc++ -std=3Dc++11 main_bug.cpp
If either of the flags are removed (to compile in C++03 mode, or to use the=
 non-clang standard library), the code compiles fine.  If the typedef is re=
moved or commented out, clang++ compiles the code fine.  If the typedef is =
moved inside the "Member" inner class, the code compiles fine (even if a se=
cond typedef pulls it back into the main body of the template).

My clang version information:
    Apple clang version 4.1 (tags/Apple/clang-421.11.65) (based on LLVM 3.1=
    Target: x86_64-apple-darwin12.2.0
    Thread model: posix

The error output:

main_bug.cpp:7:34: error: no type named 'iterator' in 'std::__1::map<int, T=
empl8<int>::Member *, std::__1::less<int>, std::__1::allocator<std::__1::pa=
ir<const int, Templ8<int>::Member *>>>'
        typename map<K,Member*>::iterator it;
/usr/bin/../lib/c++/v1/type_traits:1184:57: note: in instantiation of membe=
r class 'Templ8<int>::Member' requested here
decltype((_VSTD::declval<_Tp>() =3D _VSTD::declval<_Arg>(), true_type()))
/usr/bin/../lib/c++/v1/type_traits:1186:1: note: while substituting deduced=
 template arguments into function template '__is_assignable_test' [with _Tp=
 =3D Templ8<int>::Member *&, _Arg =3D <no value>]
__is_assignable_test(_Tp&&, _Arg&&);
/usr/bin/../lib/c++/v1/type_traits:1214:14: note: in instantiation of templ=
ate class 'std::__1::__is_assignable_imp<Templ8<int>::Member *&, Templ8<int=
>::Member *&, false>' requested here
    : public __is_assignable_imp<_Tp, _Arg> {};
/usr/bin/../lib/c++/v1/type_traits:2616:38: note: in instantiation of templ=
ate class 'std::__1::is_assignable<Templ8<int>::Member *&, Templ8<int>::Mem=
ber *&>' requested here
    : public __is_nothrow_assignable<is_assignable<_Tp, _Arg>::value, _Tp, =
/usr/bin/../lib/c++/v1/type_traits:2667:14: note: in instantiation of templ=
ate class 'std::__1::is_nothrow_assignable<Templ8<int>::Member *&, Templ8<i=
nt>::Member *&>' requested here
    : public is_nothrow_assignable<typename add_lvalue_reference<_Tp>::type=
/usr/bin/../lib/c++/v1/utility:250:20: note: (skipping 9 contexts in backtr=
ace; use -ftemplate-backtrace-limit=3D0 to see all)
/usr/bin/../lib/c++/v1/__config:253:34: note: expanded from macro '_NOEXCEP=
#  define _NOEXCEPT_(x) noexcept(x)
/usr/bin/../lib/c++/v1/memory:2386:15: note: in instantiation of template c=
lass 'std::__1::__libcpp_compressed_pair_imp<std::__1::__tree_end_node<std:=
:__1::__tree_node_base<void *> *>,
      std::__1::allocator<std::__1::__tree_node<std::__1::pair<int, Templ8<=
int>::Member *>, void *>>, 2>' requested here
    : private __libcpp_compressed_pair_imp<_T1, _T2>
/usr/bin/../lib/c++/v1/__tree:813:56: note: in instantiation of template cl=
ass 'std::__1::__compressed_pair<std::__1::__tree_end_node<std::__1::__tree=
_node_base<void *> *>,
      std::__1::allocator<std::__1::__tree_node<std::__1::pair<int, Templ8<=
int>::Member *>, void *>>>' requested here
    __compressed_pair<__end_node_t, __node_allocator>  __pair1_;
/usr/bin/../lib/c++/v1/map:711:22: note: in instantiation of template class=
 'std::__1::__tree<std::__1::pair<int, Templ8<int>::Member *>, std::__1::__=
map_value_compare<int, Templ8<int>::Member *,
      std::__1::less<int>, true>, std::__1::allocator<std::__1::pair<int, T=
empl8<int>::Member *>>>' requested here
    typedef typename __base::__node_traits                 __node_traits;
main_bug.cpp:9:22: note: in instantiation of template class 'std::__1::map<=
int, Templ8<int>::Member *, std::__1::less<int>, std::__1::allocator<std::_=
_1::pair<const int, Templ8<int>::Member *>>>'
      requested here
    typedef typename map<K,Member*>::iterator iterator_type;
main_bug.cpp:13:17: note: in instantiation of template class 'Templ8<int>' =
requested here
    Templ8<int> test;
1 error generated.
9/27/2012 9:11:22 PM
comp.sys.mac.programmer.help 4653 articles. 2 followers. Post Follow

0 Replies

Similar Articles

[PageSpeed] 7