www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 22339] New: importC: error message with character literal


          Issue ID: 22339
           Summary: importC: error message with character literal reports
                    as integer instead of character literal.
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: minor
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: dave287091 gmail.com

The following erroneous C program gives an unusual error message:

// err.c
int bar(void){
        case.'1': // erroneous . instead of a space
    return 0;

err.c(4): Error: expression expected, not `.`
err.c(4): Error: found `49` when expecting `:`
err.c(4): Error: found `:` instead of statement

I expected the second error to be reported as a character literal, not as the
integer value of the character literal.

I can also trigger it in the following situations:

enum {foo = .'1'};


Sep 27 2021