aboutsummaryrefslogtreecommitdiff
path: root/expr.c
diff options
context:
space:
mode:
Diffstat (limited to 'expr.c')
-rw-r--r--expr.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/expr.c b/expr.c
index 2e74ba4..591d80a 100644
--- a/expr.c
+++ b/expr.c
@@ -415,6 +415,7 @@ primaryexpr(struct scope *s)
{
struct expr *e;
struct decl *d;
+ struct type *t;
char *src, *dst, *end;
int base;
@@ -453,10 +454,15 @@ primaryexpr(struct scope *s)
break;
case TCHARCONST:
src = tok.lit;
- if (*src != '\'')
- fatal("wide character constant not yet implemented");
+ t = &typeint;
+ switch (*src) {
+ case 'L': ++src; t = targ->typewchar; break;
+ case 'u': ++src; t = &typeushort; break;
+ case 'U': ++src; t = &typeuint; break;
+ }
+ assert(*src == '\'');
++src;
- e = mkconstexpr(&typeint, unescape(&src));
+ e = mkconstexpr(t, unescape(&src));
if (*src != '\'')
error(&tok.loc, "character constant contains more than one character: %c", *src);
next();