Re: sizeof

Russell Shaw
2022-05-11T08:16:43Z

int bar() {
return 0;
}

template<class T = int()> void foo()
{
T p = bar;
}

int
main(int argc, char *argv[])
{
foo();
}

g++ ...
main.cpp: In instantiation of ‘void foo() [with T = int()]’:
main.cpp:13:9: required from here
main.cpp:7:7: error: variable ‘p’ has function type
7 | T p = bar;
| ^
***************************************************

If the "int()" type-id decayed to "int(*)()", this would work.

"sizeof(int()) => 1" just seems wrong, but maybe it's a matter of taste that has
been explicitly decided.