https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115430
Bug ID: 115430
Summary: Cannot take address of template function
Product: gcc
Version: 15.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: thomaspkhealy at yahoo dot com
Target Milestone: ---
template<typename... Params>
constexpr int Func(Params&&...)
{
return 0;
}
int main(void)
{
constexpr auto fp1 = &Func<int,double,float>; // compiles
constexpr auto fp2 = (nullptr, &Func<int,double,float>); // doesn't
compile
}
The above program compiles without failure on LLVM clang, Microsoft Visual C++
and Intel ICX. But GNU g++ fail to compile it:
<source>: In function 'int main()':
<source>:10:36: error: no context to resolve type of '& Func<int, double,
float>'
10 | constexpr auto fp2 = (nullptr, &Func<int,double,float>); //
doesn't compile