https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103620
Bug ID: 103620
Summary: 'internal compiler error: in tsubst_copy_and_build, at
cp/pt.c:20479' when calling concept
Product: gcc
Version: og11 (devel/omp/gcc-11)
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: maik.urbannek at cattatech dot de
Target Milestone: ---
```cpp
#include <concepts>
template<typename T>
concept Concept = std::same_as<T,int>;
template <class T>
bool foo( )
{
const T t ={};
const auto serial = Concept<T>(t);
return true;
}
int main() {
return foo<int>();
}
```
`gcc -o error error.cpp -std=c++20`
produces:
```
error.cpp: In instantiation of ‘bool foo() [with T = int]’:
error.cpp:15:20: required from here
error.cpp:10:35: internal compiler error: in tsubst_copy_and_build, at
cp/pt.c:20479
10 | const auto serial = Concept<T>(t);
| ~~~~~~~~~~^~~
0x71822c tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
../../src/gcc/cp/pt.c:20479
0x116be57 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../src/gcc/cp/pt.c:19159
0x1229514 tsubst_init
../../src/gcc/cp/pt.c:16531
0x116c19d tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../src/gcc/cp/pt.c:18368
0x116bf43 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../src/gcc/cp/pt.c:18199
0x116beb5 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../src/gcc/cp/pt.c:18550
0x1228bd0 instantiate_body
../../src/gcc/cp/pt.c:25876
0x1227ffa instantiate_decl(tree_node*, bool, bool)
../../src/gcc/cp/pt.c:26170
0xfa5f60 instantiate_pending_templates(int)
../../src/gcc/cp/pt.c:26249
0xfa20c3 c_parse_final_cleanups()
../../src/gcc/cp/decl2.c:4962
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <file:///usr/share/doc/gcc-11/README.Bugs> for instructions.
```
expected:
```
error.cpp: In function ‘bool foo()’:
error.cpp:10:35: error: expression cannot be used as a function
10 | const auto serial = Concept<T>();
|
```