shevek / jcpp

The C Preprocessor as a Java library
http://www.anarres.org/projects/jcpp/
Apache License 2.0
106 stars 36 forks source link

ClassCastException with character constants in expressions #34

Closed io7m closed 7 years ago

io7m commented 7 years ago

Hello! The following file yields a ClassCastException:

#define EXAMPLE_X 'a'

#if EXAMPLE == EXAMPLE_X
#endif

I have a small repro case here:

https://github.com/io7m/jcpp-bug-20170423

The bug appears to be at:

https://github.com/shevek/jcpp/blob/master/src/main/java/org/anarres/cpp/Preprocessor.java#L1598

The value held by the token isn't a Character but a String.

io7m commented 7 years ago

Nice work. Thanks!