<html>
<head>
<base href="https://bugs.llvm.org/">
</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 - Constexpr new: strange behavior and lack of diagnostic information"
href="https://bugs.llvm.org/show_bug.cgi?id=43674">43674</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Constexpr new: strange behavior and lack of diagnostic information
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</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>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Frontend
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>zamazan4ik@tut.by
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk
</td>
</tr></table>
<p>
<div>
<pre>I cannot understand why on the example:
#include <iostream>
#include <deque>
int main()
{
constexpr auto res = []
{
std::deque<int> d;
//d.push_back(42);
return d.size();
}();
std::cout << res << std::endl;
return 0;
}
I get the error:
/home/zamazan4ik/OpenSource/test_llvm_lib/main.cpp:6:20: error: constexpr
variable 'res' must be initialized by a constant expression
constexpr auto res = []
^ ~~
without any additional information what is going wrong.
But if you uncomment line with push_back - all will be fine. I cannot
understand, what is wrong here.
My try for constexpr deque you can find here:
<a href="https://github.com/ZaMaZaN4iK/llvm-project/tree/feature/deque_constexpr">https://github.com/ZaMaZaN4iK/llvm-project/tree/feature/deque_constexpr</a>
Preprocessed file: <a href="https://gofile.io/?c=VOmzKT">https://gofile.io/?c=VOmzKT</a></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>