https://llvm.org/bugs/show_bug.cgi?id=23647
Bug ID: 23647
Summary: auto p = std::make_shared<volatile T>() does not
compile
Product: libc++
Version: 3.6
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: All Bugs
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected]
Classification: Unclassified
Hi,
the following program fails to compile with Clang 3.5, 3.6 and libc++ 3.5, 3.6,
although IMHO it should:
#include <memory>
int main() {
auto p = std::make_shared<volatile bool>(false);
}
$ clang++-3.6 -std=c++11 -stdlib=libc++ make_volatile_something.cpp
In file included from make_volatile_something.cpp:1:
/usr/include/c++/v1/memory:4284:9: error: no matching member function for call
to '__enable_weak_this'
__r.__enable_weak_this(__r.__ptr_);
~~~~^~~~~~~~~~~~~~~~~~
/usr/include/c++/v1/memory:4644:29: note: in instantiation of function template
specialization 'std::__1::shared_ptr<volatile
bool>::make_shared<bool>' requested here
return shared_ptr<_Tp>::make_shared(_VSTD::forward<_Args>(__args)...);
^
make_volatile_something.cpp:4:16: note: in instantiation of function template
specialization 'std::__1::make_shared<volatile bool, bool>'
requested here
auto p = std::make_shared<volatile bool>(false);
^
/usr/include/c++/v1/memory:4008:10: note: candidate function not viable: no
known conversion from 'element_type *' (aka 'volatile bool *') to
'const void *' for 1st argument; take the address of the argument with &
void __enable_weak_this(const void*) _NOEXCEPT {}
^
/usr/include/c++/v1/memory:4001:9: note: candidate template ignored: could not
match 'enable_shared_from_this<type-parameter-0-0>' against
'volatile bool'
__enable_weak_this(const enable_shared_from_this<_Yp>* __e) _NOEXCEPT
^
1 error generated.
The above program compiles fine with GCC 4.9 and its libstdc++.
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs