Skip to content

bail out on invalid number in #line preprocessor directive #663

Description

@firewave

Mentioned in #586 (comment).

#line -1

Is being reject by GCC

a.cpp:1:7: error: ‘-’ after ‘#line’ is not a positive integer
    1 | #line -1
      |       ^

and Clang

a.cpp:1:7: error: #line directive requires a positive integer argument
    1 | #line -1
      |       ^

but we just accept it.

See https://en.cppreference.com/cpp/preprocessor/line.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions