<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 - consteval function not allowed in default argument to constexpr constructor"
href="https://bugs.llvm.org/show_bug.cgi?id=48886">48886</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>consteval function not allowed in default argument to constexpr constructor
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>11.0
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</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>C++2a
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>src@andyf.de
</td>
</tr>
<tr>
<th>CC</th>
<td>blitzrakete@gmail.com, erik.pilkington@gmail.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk
</td>
</tr></table>
<p>
<div>
<pre>Hello,
the following valid code is currently rejected by Clang 11 and trunk
(<a href="https://godbolt.org/z/645McM">https://godbolt.org/z/645McM</a>):
consteval int Fun() { return 0; }
struct Test {
constexpr Test(int loc = Fun()) {}
};
Test t{};
The error is:
<source>:4:28: error: cannot take address of consteval function 'Fun' outside
of an immediate invocation
constexpr Test(int loc = Fun()) {}
^
<source>:1:15: note: declared here
consteval int Fun() { return 0; }
^
1 error generated.
Compiler returned: 1
I had a brief communication with Richard Smith who confirmed that the code
above is valid.
I assume this bug is similar to <a class="bz_bug_link
bz_status_NEW "
title="NEW - Pointer to consteval function not allowed in default argument to consteval function"
href="show_bug.cgi?id=47714">https://bugs.llvm.org/show_bug.cgi?id=47714</a>
Best,
Andreas</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>