<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/83979>83979</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Clang rejects call to base class member function inside requires inside constexpr if using scope resolution operatot
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
ranaanoop
</td>
</tr>
</table>
<pre>
The following program is rejected by clang :[Demo](https://godbolt.org/z/34ra7aM1s)
```
#include<type_traits>
template<typename T>
struct AlwaysFalse : public std::false_type {};
struct B
{
template<typename S>
void foo(){}
};
template <typename T,typename S>
struct A:T
{
auto foo(){
if constexpr (requires{T::template foo<S>();})
return 1;
else
static_assert(AlwaysFalse<A>::value,
"foo is not implemented.");
}
};
int main()
{
A<B,double> a;
a.foo();
}
```
Clang says:
```
<source>:19:22: error: static assertion failed due to requirement 'AlwaysFalse<A<B, double>>::value': foo is not implemented.
19 | static_assert(AlwaysFalse<A>::value,
| ^~~~~~~~~~~~~~~~~~~~~
<source>:27:3: note: in instantiation of member function 'A<B, double>::foo' requested here
27 | a.foo();
| ^
1 error generated.
Compiler returned: 1
```
---
Note program work if we change constexpr if to `if constexpr (requires(T t){t. template foo<S>();})`. [Demo](https://godbolt.org/z/jKGfenq1o)
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJykVcGSozYQ_Zrm0jUukIwxBw42HueQSi7xfUpAY2sjJFYSM3EO-faUANtjr3crqaVcBgnx-vXrfpJwTh41UQHpFtJdJAZ_MrawQguhjemjyjTn4nAibI1S5kPqI_bWHK3oUDq09IVqTw1WZ6yV0EcEvoF0u6POQLoDtj5537swyfbA9kfTVEb5hbFHYPu_ge350opM_JY4YDnEO4g3sIrn3zRkXOpaDQ0BL_25pzdvhfQO-Ou0AKebp65Xwl9WadERHq6LnLdD7XGjPsTZ7YVyFJhiP1RK1uh8EyjyTRvevIXvEbItZD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