Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.sys.mac.programmer.help > #154

clang bug under c++11?

Received by 10.66.86.133 with SMTP id p5mr1608116paz.12.1348780282795; Thu, 27 Sep 2012 14:11:22 -0700 (PDT)
Received by 10.68.225.234 with SMTP id rn10mr1785282pbc.3.1348780282778; Thu, 27 Sep 2012 14:11:22 -0700 (PDT)
Path csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!news.linkpendium.com!news.linkpendium.com!news.snarked.org!newsfeed.news.ucla.edu!usenet.stanford.edu!kq19no1570683pbb.0!news-out.google.com!t10ni23588900pbh.0!nntp.google.com!kt20no448952pbb.1!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
Newsgroups comp.sys.mac.programmer.help
Date Thu, 27 Sep 2012 14:11:22 -0700 (PDT)
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=64.0.193.15; posting-account=eAFT1QoAAAA7xGSNlw9BCWh-5kbVuN0T
NNTP-Posting-Host 64.0.193.15
User-Agent G2/1.0
MIME-Version 1.0
Message-ID <91a68b38-babd-4efe-942f-08adab8f2b7a@googlegroups.com> (permalink)
Subject clang bug under c++11?
From alpha.eta.pi@gmail.com
Injection-Date Thu, 27 Sep 2012 21:11:22 +0000
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding quoted-printable
Xref csiph.com comp.sys.mac.programmer.help:154

Show key headers only | View raw


Can anyone tell me where to direct bugs in the Apple clang compiler?  I have a short C++ program that clang fails to compile properly, but G++ compiles 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=libc++ -std=c++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 removed 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 second 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.1svn)
    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, Templ8<int>::Member *, std::__1::less<int>, std::__1::allocator<std::__1::pair<const int, Templ8<int>::Member *>>>'
        typename map<K,Member*>::iterator it;
        ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
/usr/bin/../lib/c++/v1/type_traits:1184:57: note: in instantiation of member class 'Templ8<int>::Member' requested here
decltype((_VSTD::declval<_Tp>() = _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 = Templ8<int>::Member *&, _Arg = <no value>]
__is_assignable_test(_Tp&&, _Arg&&);
^
/usr/bin/../lib/c++/v1/type_traits:1214:14: note: in instantiation of template 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 template class 'std::__1::is_assignable<Templ8<int>::Member *&, Templ8<int>::Member *&>' requested here
    : public __is_nothrow_assignable<is_assignable<_Tp, _Arg>::value, _Tp, _Arg>
                                     ^
/usr/bin/../lib/c++/v1/type_traits:2667:14: note: in instantiation of template class 'std::__1::is_nothrow_assignable<Templ8<int>::Member *&, Templ8<int>::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 backtrace; use -ftemplate-backtrace-limit=0 to see all)
                   is_nothrow_copy_assignable<second_type>::value)
                   ^
/usr/bin/../lib/c++/v1/__config:253:34: note: expanded from macro '_NOEXCEPT_'
#  define _NOEXCEPT_(x) noexcept(x)
                                 ^
/usr/bin/../lib/c++/v1/memory:2386:15: note: in instantiation of template class '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 class '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, Templ8<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.

Back to comp.sys.mac.programmer.help | Previous | Next | Find similar


Thread

clang bug under c++11? alpha.eta.pi@gmail.com - 2012-09-27 14:11 -0700

csiph-web