bad error message on incorrect string literal
| Bugzilla Link | 17705 |
| Version | 3.2 |
| OS | Linux |
| Reporter | LLVM Bugzilla Contributor |
| CC | @DougGregor |
Extended Description
linefeed should not be printed inside quotes. Instead error should be something like "invalid newline character in raw string delimiter".
5.cpp:1:21: error: invalid character '
' character in raw string delimiter; use PREFIX( )PREFIX to delimit raw string
char const* a = R"";
^
5.cpp:1:17: error: expected expression
char const* a = R"";
^
2 errors generated.
reproducer: https://godbolt.org/z/9o8Gxavjr
char const* a = R"
";
The diagnostic is err_invalid_char_raw_delim
We issue it here:
https://github.com/llvm/llvm-project/blob/074630e8af94d839f6baf6378d7ed3d7a6d2753c/clang/lib/Lex/Lexer.cpp#L2229-L2230
I think a simple check for newline and maybe add a new diagnostic for this case invalid newline ....
Hi!
This issue may be a good introductory issue for people new to working on LLVM. If you would like to work on this issue, your first steps are:
- In the comments of the issue, request for it to be assigned to you.
- Fix the issue locally.
- Run the test suite locally. Remember that the subdirectories under
test/create fine-grained testing targets, so you can e.g. usemake check-clang-astto only run Clang's AST tests. - Create a Git commit.
- Run
git clang-format HEAD~1to format your changes. - Open a pull request to the upstream repository on GitHub. Detailed instructions can be found in GitHub's documentation.
If you have any further questions about this issue, don't hesitate to ask via a comment in the thread below.
@llvm/issue-subscribers-good-first-issue
Author: None (llvmbot)
Extended Description
linefeed should not be printed inside quotes. Instead error should be something like "invalid newline character in raw string delimiter".
5.cpp:1:21: error: invalid character '
' character in raw string delimiter; use PREFIX( )PREFIX to delimit raw string
char const* a = R"";
^
5.cpp:1:17: error: expected expression
char const* a = R"";
^
2 errors generated.
@shafik, I will start analysing the issue.
Not merged yet.
I have merged it now. Is it merged? Please close if it’s merged