<html>
<head>
<base href="https://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW " title="NEW --- - auto p = std::make_shared<volatile T>() does not compile" href="https://urldefense.proofpoint.com/v2/url?u=https-3A__llvm.org_bugs_show-5Fbug.cgi-3Fid-3D23647&d=AwMBaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=pF93YEPyB-J_PERP4DUZOJDzFVX5ZQ57vQk33wu0vio&m=UpY9fin0vqX4LkCTaXJML1Rt-rrfachzByjGfdatVYU&s=27B6dO1OuUgkFTNTijyJjjWZdiXMRGfhP8PoiJfE3nU&e=">23647</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>auto p = std::make_shared<volatile T>() does not compile
</td>
</tr>
<tr>
<th>Product</th>
<td>libc++
</td>
</tr>
<tr>
<th>Version</th>
<td>3.6
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>All Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>yegor.derevenets@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvmbugs@cs.uiuc.edu, mclow.lists@gmail.com
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>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++.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>