<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 - [concepts] Can template / constraint functions be inherited?"
href="https://bugs.llvm.org/show_bug.cgi?id=51544">51544</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>[concepts] Can template / constraint functions be inherited?
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>12.0
</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>C++2a
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>llvm@marehr.dialup.fu-berlin.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>Hi clang-team,
I'm not sure if this is a defect or standard behaviour, but the following code
compiles with gcc, but not with clang:
```cpp
#include <concepts>
#ifndef MODE
#define MODE 0
#endif
struct base {
#if MODE == 0
void foo(float target){};
#elif MODE == 1
template <typename target_t>
void foo(target_t target){};
#elif MODE == 2
template <std::floating_point target_t>
void foo(target_t target){};
#endif
};
struct bar : public base {
using base::foo;
template <std::integral target_t>
void foo(target_t target){};
};
int main() {
bar f{};
f.foo(float{});
}
```
<a href="https://godbolt.org/z/GGjbqdbvq">https://godbolt.org/z/GGjbqdbvq</a>
MODE | 0 | 1 | 2 |
------|---|---|---|
gcc | ✓ | ✓ | ✓ |
clang | ✓ | ✗ | ✗ |
msvc | ✓ | ✗ | ✗ |
I'm unsure if constructs like this are even allowed.
Thank you!</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>