[LLVMbugs] [Bug 10847] New: precompiled header broken with c++0x (issue with rvalue ?)

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Sep 2 15:02:49 PDT 2011


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

           Summary: precompiled header broken with c++0x (issue with
                    rvalue ?)
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++0x
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: devlists at shadowlab.org
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com


Created an attachment (id=7210)
 --> (http://llvm.org/bugs/attachment.cgi?id=7210)
Sample

While trying to compile a c++0x file using precompiled header, clang failed
with some error diagnostics that does not appear without precompiled header.

This bug occurs when trying to used precompiled libc++ headers for instance
(either trunk or Xcode 4.1 libc++ version).

And as it is a precompiled header bug, it's not easy to write a simple reduced
test case.

To reproduce the bug, you can use the attached sample.
Uncompress the archive. cd to the created directory. launch test.sh

By default, the test.sh script will try to use the system libc++, but you can
use the attached preprocessed version instead by toggling commented lines in
the script.

$tar -xf bug.tbz
$cd bug
$bash test.sh

# Compile without precompiled header. Works fine
clang++ -std=c++0x -stdlib=libc++ -include include/map.h -c map.cpp

# Precompile header
# toggle between the 2 following line to use either the system libc++ (first
line) 
# or the included preprocessed libc++ header file.
clang++ -x c++-header -std=c++0x -stdlib=libc++ include/map.h -o map.h.pth
# clang++ -v -x c++-header -std=c++0x include/libc++.ii -o map.h.pth

# Compile using precompiled header
clang++ -std=c++0x -stdlib=libc++ -include map.h -c map.cpp
In file included from map.cpp:1:
In file included from Desktop/bug/include/map.h:2:
In file included from
llvm/release/Release+Asserts/bin/../lib/c++/v1/unordered_map:318:
In file included from
llvm/release/Release+Asserts/bin/../lib/c++/v1/__hash_table:16:
llvm/release/Release+Asserts/bin/../lib/c++/v1/memory:1469:26: error: call to
constructor of 'true_type'
      (aka 'integral_constant<bool, true>') is ambiguous
            {__construct(__has_construct<allocator_type, pointer, _Args...>(),
                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
llvm/release/Release+Asserts/bin/../lib/c++/v1/unordered_map:1066:20: note: in
instantiation of function template specialization
     
'std::__1::allocator_traits<std::__1::allocator<std::__1::__hash_node<std::__1::pair<const
char *, void *>, void *> > >::construct<const char *, const char *const
      &>' requested here
    __node_traits::construct(__na, _VSTD::addressof(__h->__value_.first),
                   ^
llvm/release/Release+Asserts/bin/../lib/c++/v1/unordered_map:1146:25: note: in
instantiation of function template specialization
      'std::__1::unordered_map<const char *, void *, std::__1::hash<const char
*>, std::__1::equal_to<const char *>, std::__1::allocator<std::__1::pair<const
char *const,
      void *> > >::__construct_node<const char *const &, , void>' requested
here
    __node_holder __h = __construct_node(__k);
                        ^
map.cpp:7:17: note: in instantiation of member function
'std::__1::unordered_map<const char *, void *, std::__1::hash<const char *>,
std::__1::equal_to<const char *>,
      std::__1::allocator<std::__1::pair<const char *const, void *> >
>::operator[]' requested here
 sAllClassesDict[name] = NULL;
                ^
llvm/release/Release+Asserts/bin/../lib/c++/v1/type_traits:161:24: note:
candidate is the implicit move constructor
struct _LIBCPP_VISIBLE integral_constant
                       ^
llvm/release/Release+Asserts/bin/../lib/c++/v1/type_traits:161:24: note:
candidate is the implicit move constructor
llvm/release/Release+Asserts/bin/../lib/c++/v1/type_traits:161:24: note:
candidate is the implicit copy constructor
llvm/release/Release+Asserts/bin/../lib/c++/v1/memory:1530:42: note: passing
argument to parameter here
        static void __construct(true_type, allocator_type& __a, _Tp* __p,
_Args&&... __args)
                                         ^
llvm/release/Release+Asserts/bin/../lib/c++/v1/memory:1469:26: error: call to
constructor of 'true_type'
      (aka 'integral_constant<bool, true>') is ambiguous
            {__construct(__has_construct<allocator_type, pointer, _Args...>(),
                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
llvm/release/Release+Asserts/bin/../lib/c++/v1/unordered_map:1069:20: note: in
instantiation of function template specialization
     
'std::__1::allocator_traits<std::__1::allocator<std::__1::__hash_node<std::__1::pair<const
char *, void *>, void *> > >::construct<void *, >' requested here
    __node_traits::construct(__na, _VSTD::addressof(__h->__value_.second),
                   ^
llvm/release/Release+Asserts/bin/../lib/c++/v1/unordered_map:1146:25: note: in
instantiation of function template specialization
      'std::__1::unordered_map<const char *, void *, std::__1::hash<const char
*>, std::__1::equal_to<const char *>, std::__1::allocator<std::__1::pair<const
char *const,
      void *> > >::__construct_node<const char *const &, , void>' requested
here
    __node_holder __h = __construct_node(__k);
                        ^
map.cpp:7:17: note: in instantiation of member function
'std::__1::unordered_map<const char *, void *, std::__1::hash<const char *>,
std::__1::equal_to<const char *>,
      std::__1::allocator<std::__1::pair<const char *const, void *> >
>::operator[]' requested here
 sAllClassesDict[name] = NULL;
                ^
llvm/release/Release+Asserts/bin/../lib/c++/v1/type_traits:161:24: note:
candidate is the implicit move constructor
struct _LIBCPP_VISIBLE integral_constant
                       ^
llvm/release/Release+Asserts/bin/../lib/c++/v1/type_traits:161:24: note:
candidate is the implicit move constructor
llvm/release/Release+Asserts/bin/../lib/c++/v1/type_traits:161:24: note:
candidate is the implicit copy constructor
llvm/release/Release+Asserts/bin/../lib/c++/v1/memory:1530:42: note: passing
argument to parameter here
        static void __construct(true_type, allocator_type& __a, _Tp* __p,
_Args&&... __args)
                                         ^
In file included from map.cpp:1:
In file included from Desktop/bug/include/map.h:2:
In file included from
llvm/release/Release+Asserts/bin/../lib/c++/v1/unordered_map:318:
In file included from
llvm/release/Release+Asserts/bin/../lib/c++/v1/__hash_table:18:
llvm/release/Release+Asserts/bin/../lib/c++/v1/algorithm:2296:33: error: call
to constructor of
      'std::__1::__less<unsigned long, unsigned long>' is ambiguous
    return _VSTD::max(__a, __b, __less<_Tp>());
                                ^~~~~~~~~~~~~
llvm/release/Release+Asserts/bin/../lib/c++/v1/__hash_table:1204:20: note: in
instantiation of function template specialization
      'std::__1::max<unsigned long>' requested here
            rehash(_VSTD::max<size_type>(2 * __bc + 1,
                   ^
llvm/release/Release+Asserts/bin/../lib/c++/v1/__config:178:15: note: expanded
from:
#define _VSTD std::_LIBCPP_NAMESPACE
              ^
llvm/release/Release+Asserts/bin/../lib/c++/v1/unordered_map:1147:41: note: in
instantiation of member function
      'std::__1::__hash_table<std::__1::pair<const char *, void *>,
std::__1::__unordered_map_hasher<std::__1::pair<const char *, void *>,
std::__1::hash<const char *>,
      true>, std::__1::__unordered_map_equal<std::__1::pair<const char *, void
*>, std::__1::equal_to<const char *>, true>,
std::__1::allocator<std::__1::pair<const char
      *, void *> > >::__node_insert_unique' requested here
    pair<iterator, bool> __r = __table_.__node_insert_unique(__h.get());
                                        ^
map.cpp:7:17: note: in instantiation of member function
'std::__1::unordered_map<const char *, void *, std::__1::hash<const char *>,
std::__1::equal_to<const char *>,
      std::__1::allocator<std::__1::pair<const char *const, void *> >
>::operator[]' requested here
 sAllClassesDict[name] = NULL;
                ^
llvm/release/Release+Asserts/bin/../lib/c++/v1/algorithm:632:8: note: candidate
is the implicit move constructor
struct __less
       ^
llvm/release/Release+Asserts/bin/../lib/c++/v1/algorithm:632:8: note: candidate
is the implicit move constructor
llvm/release/Release+Asserts/bin/../lib/c++/v1/algorithm:632:8: note: candidate
is the implicit copy constructor
llvm/release/Release+Asserts/bin/../lib/c++/v1/algorithm:2286:46: note: passing
argument to parameter '__comp' here
max(const _Tp& __a, const _Tp& __b, _Compare __comp)
                                             ^
3 errors generated.

-- 
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