hsutter / cppfront

A personal experimental C++ Syntax 2 -> Syntax 1 compiler
Other
5.27k stars 225 forks source link

feat: accept function type argument #923

Open JohelEGP opened 6 months ago

JohelEGP commented 6 months ago

Resolves https://github.com/hsutter/cppfront/discussions/628#discussioncomment-8050552.

Testing summary:

100% tests passed, 0 tests failed out of 906

Total Test time (real) =  47.97 sec

Acknowledgements:

hsutter commented 6 months ago

From #628:

But what about offsetof (https://en.cppreference.com/w/cpp/types/offsetof)? And more generally the compiler built-ins? Unfortunately, generally supporting function type arguments seems like it would require typename.

Can you elaborate with examples where this is used? I'm not seeing the use cases in the PR code shown so far, unless the answer to my first question about sizeof(type ...) is that the type alters the meaning somehow.

JohelEGP commented 6 months ago

From #628:

But what about offsetof (https://en.cppreference.com/w/cpp/types/offsetof)? And more generally the compiler built-ins? Unfortunately, generally supporting function type arguments seems like it would require typename.

Can you elaborate with examples where this is used? I'm not seeing the use cases in the PR code shown so far, unless the answer to my first question about sizeof(type ...) is that the type alters the meaning somehow.

I wanted to try this, but I think -Werror/\W4 would make this hard. https://gcc.gnu.org/onlinedocs/gcc/C-Extensions.html reads:

(The -pedantic option directs GCC to print a warning message if any of these features is used.)