paul-j-lucas/cdecl

Add support for using type alias.

Closed this issue · 3 comments

Are there any plans to add C++ using type aliases?

c++decl> explain typedef int v3[3];
declare v3 as type array 3 of int
c++decl> explain using v3 = int[3];
                 ^
9: syntax error: "using": unexpected token
c++decl>

For some reason, I don't get notified of new issues when they're created, so I didn't see this until just now just after I published cdecl 4.5 that contains support for C++11's using declarations. However, I forgot to add support for explaining using declarations. I'll get around to it.

I also discovered that there are some broken using cases like the one you gave. :(

OK, I just added support for explain using name = gibberish.

I also realized that the breakage isn't limited to using. It fails to parse array declarations without a name, e.g., explain void f(char[]). If you insert a name like explain void f(char s[]) then it works.

Unfortunately, it's not an easy fix and will likely require some serious reworking of parts of the grammar so as not to trigger a gazillion more shift/reduce conflicts (as well as new reduce/reduce conflicts).

With 671 unit tests, you'd think I would have caught this earlier; but no. :(

Unfortunately, it's not an easy fix and will likely require some serious reworking of parts of the grammar so as not to trigger a gazillion more shift/reduce conflicts (as well as new reduce/reduce conflicts).

It turns out that the fix was simpler than I thought. It's fixed in 4.6.1.