[LLVMbugs] [Bug 23647] New: auto p = std::make_shared<volatile T>() does not compile
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Mon May 25 03:16:32 PDT 2015
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: unassignedclangbugs at nondot.org
Reporter: yegor.derevenets at gmail.com
CC: llvmbugs at cs.uiuc.edu, mclow.lists at gmail.com
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150525/021e4645/attachment.html>
More information about the llvm-bugs
mailing list