[Issue 23693] New: compilable/testcstuff3.i:7:1: error: stray '#' in program

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Feb 12 14:49:40 UTC 2023


https://issues.dlang.org/show_bug.cgi?id=23693

          Issue ID: 23693
           Summary: compilable/testcstuff3.i:7:1: error: stray '#' in
                    program
           Product: D
           Version: D2
          Hardware: All
                OS: Linux
            Status: NEW
          Severity: major
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: ibuclaw at gdcproject.org

When compiling the test with `gcc -std=c11 -fsyntax-only`

compilable/testcstuff3.i:7:1: error: stray ‘#’ in program
    7 | #line 1050 "cstuff3.c" extra tokens ignored (should warn?)
      | ^
compilable/testcstuff3.i:7:7: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or
‘__attribute__’ before numeric constant
    7 | #line 1050 "cstuff3.c" extra tokens ignored (should warn?)
      |       ^~~~
compilable/testcstuff3.i:10:1: error: stray ‘#’ in program
   10 | #line 1000
      | ^
compilable/testcstuff3.i:11:1: error: stray ‘%:’ in program
   11 | %:line 1010
      | ^~
compilable/testcstuff3.i:13:22: error: invalid flag "2" in line directive
   13 | # 1020 "cstuff3.c" 1 2 3 4
      |                      ^
compilable/testcstuff3.i:13:24: warning: extra tokens at end of ## directive
   13 | # 1020 "cstuff3.c" 1 2 3 4
      |                        ^

Original test content:
```

/* cpp doesn't like this, so don't run preprocessor on this file
 */

/********************************/

#line 1050 "cstuff3.c" extra tokens ignored (should warn?)


#line 1000
%:line 1010

# 1020 "cstuff3.c" 1 2 3 4
# 1030
struct S21944
{
    int var;
#1040 "cstuff3.c" 3 4
};

_Static_assert(U'\U00011234' == 0x11234, "ok"); // sppn.exe doesn't support U
character literals
```

--


More information about the Digitalmars-d-bugs mailing list