[LLVMbugs] [Bug 9975] New: [C++0x] Inconsistency I don't understand

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri May 20 14:29:11 PDT 2011


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

           Summary: [C++0x] Inconsistency I don't understand
           Product: clang
           Version: trunk
          Platform: Macintosh
        OS/Version: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++0x
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: hhinnant at apple.com
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com


Created an attachment (id=6623)
 --> (http://llvm.org/bugs/attachment.cgi?id=6623)
Does not compile

I have two programs involving clang tip-of-trunk in c++0x mode which I can not
reconcile.  The version is:

Apple clang version 3.0 (trunk 131724) (based on LLVM 3.0svn)
Target: x86_64-apple-darwin10.7.0
Thread model: posix

The attached preprocessed test1.cpp does not compile and the first error
message is:

$ clang++ -std=c++0x test1.cpp

In file included from test.cpp:1:
In file included from test.cpp:16:
/usr/include/c++/v1/functional:1620:8: error: no type named 'type' in
'std::__1::__invoke_of<void (*&)(const std::__1::basic_string<char,
      std::__1::char_traits<char>, std::__1::allocator<char> > &), char const
(&)[1]>'
    >::type type;
    ~~~^~~~
/usr/include/c++/v1/functional:1670:18: note: in instantiation of template
class 'std::__1::__bind_return<void (*)(const std::__1::basic_string<char,
      std::__1::char_traits<char>, std::__1::allocator<char> > &),
std::__1::tuple<std::__1::placeholders::__ph<1> >, std::__1::tuple<char const
(&)[1]> >'
      requested here
        typename __bind_return<_Fd, _Td, tuple<_Args&&...> >::type
                 ^
/usr/include/c++/v1/functional:1671:9: note: while substituting deduced
template arguments into function template 'operator()'
      [with _Args = <char const (&)[1]>]
        operator()(_Args&& ...__args)
        ^
test.cpp:31:3: note: in instantiation of function template specialization
'doIt<std::__1::__bind<void (*)(const std::__1::basic_string<char,
      std::__1::char_traits<char>, std::__1::allocator<char> > &),
std::__1::placeholders::__ph<1> &> >' requested here
  doIt(std::bind(&method, _1));
  ^

In investigating the cause of this error message I developed test2.cpp which
compiles, runs and outputs:

$ clang++ -std=c++0x -stdlib=libc++ test2.cpp
1
v

This second test is directly inspecting the trait std::__invoke_of mentioned in
test1's error message:

std::cout << typeid(std::__invoke_of<void (*&)(const std::string &), char const
(&)[1]>::type).name() << '\n';

Its output contradicts the error message from test1, indicating that this
invocation of std::__invoke *does* have a nested type named 'type', and it has
type void.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list