4 ms·
Interesting, could you elaborate on this a bit more? Say I have a header file "foo.h" with an "auto foo();" declaration. Another file (eg, "bar.h") imports foo
by seccess 12y ago
Interesting, could you elaborate on this a bit more?
Say I have a header file "foo.h" with an "auto foo();" declaration. Another file (eg, "bar.h") imports foo.h. How can the compiler do type checking when compiling bar.cc without also parsing foo.cc to determine the return type of foo()?
- mkup 12y agoIf there's no function body in header (non-inline function), then it won't compile.
- deleted 12y ago[deleted]
- nanofortnight 12y agoInferrence isn't magic and has sensible limits. To quote: > Of course, this requires the function body to be visible. https://isocpp.org/wiki/faq/cpp14-language#generalized-return https://isocpp.org/wiki/faq/cpp14-language#generalized-retur...