paul-j-lucas / cdecl

Composing and deciphering C (or C++) declarations or casts, aka ‘‘gibberish.’’
GNU General Public License v3.0
90 stars 11 forks source link

syntax error for user defined literal operator with trailing return type #3

Closed IOBYTE closed 5 years ago

IOBYTE commented 5 years ago

I'm getting an error for:

c++decl> explain auto operator "" _numch(const char *ch, std::size_t size) noexcept -> std::size_t;
                               ^
23: syntax error: """: cast or declaration expected
paul-j-lucas commented 5 years ago

User-defined literals are currently not supported. (The manual page omits this fact.) I may get around to adding support for it.

paul-j-lucas commented 5 years ago

FYI: I'm almost done with adding user-defined literal support. A separate issue with your example, however, is that size_t currently is only in the global namespace (for C) and not also in the std namespace. I think it'll actually take more code to have the same name in both scopes.

paul-j-lucas commented 5 years ago

I just pushed a change for user-define literal support. Try it out (minding the size_t issue mentioned earlier).

IOBYTE commented 5 years ago

Thanks for the quick fix. It's working for me now. I had no clue what this code was doing when I saw it 3 days ago here: https://sourceforge.net/p/cppcheck/discussion/general/thread/703df00a29/ I use your program when I come across something like this that I don't understand and I was surprised it didn't work. Thanks again for the quick turnaround.

paul-j-lucas commented 5 years ago

I've hacked in support for std::size_t.

IOBYTE commented 5 years ago

Cool. Everything works now. Thanks again.