<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/113656>113656</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang] call to non-constexpr function should be supported
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
lingege321
</td>
</tr>
</table>
<pre>
I have the following code segment.
``` cpp
bool foo1(int b) {
return b==1;
}
constexpr bool foo2(int b) {
return foo1(b-5);
}
int main() {
}
```
If I use g++ to compile it. G++ will error out the message 'error: call to non-‘constexpr’ function ‘bool foo1(int)’'
Visual Studio also errors out the same error.
Only clang does not support this error and I cannot early detect the error in clangd.
Is it possible to print the same compile error as gcc?
gcc version:
gcc (GCC) 12.3.0
Copyright (C) 2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
clang version:
clang version 19.1.2 (https://github.com/llvm/llvm-project.git 7ba7d8e2f7b6445b60679da826210cdde29eaf8b)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /remote/vgrnd106/chielin/local/llvm/llvm-project-19.1.2/build/bin
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUVN1u4zYTfRr6ZmBBoqy_C134J9rPwH6bReIt0KuCIkcyW5oUSMqJ376gJGeTtEVRIIiMmeHhOWc4w5yTvUasSbYj2WHFRn82tlZS99hjSpNVa8StPsKZXRH8GaEzSpkXqXvgRiA47C-ofUTiA4m3JI_nP-DDMIdaYxR0xiSEllJ7aAmtgBS7OQsAYNGPVkNL0gNJDwlJlxwpDsuPd_-50c7j62DhDkz_DXi5vF1nhFb_hB4QLkxqQssPOJ-L7wL_yuzYwRFGh9ATuiN0B94AN5dBKgTpI_iyhF-kUoDWGgtm9JOnF3SO9QiEFlOCpFvgTKkAoY1ekwdKyphU5Zv6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