Re: sizeof
Russell Shaw <[email protected]>
| Newsgroups | gmane.comp.gdb.devel |
|---|---|
| Message-ID | <[email protected]> |
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.