Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The use of parenthesis gives compilation errors in some situations #3682

Closed
1 of 2 tasks
Danixu opened this issue Aug 6, 2022 · 2 comments
Closed
1 of 2 tasks

The use of parenthesis gives compilation errors in some situations #3682

Danixu opened this issue Aug 6, 2022 · 2 comments

Comments

@Danixu
Copy link

Danixu commented Aug 6, 2022

Description

Hello,

Trying to create a json using raw data written directly into the program code, I have noticed that when you finish an string by a parenthesis ")", the program won't compiles.

This example won't compiles:
json test = R"({ "a": "b)"})"_json;

Just adding an space to the end of the string solves the problem:
json test = R"({ "a": "b) "})"_json;

Reproduction steps

just add the above code to any part of your program.

Expected vs. actual results

The string will be threated as string instead to threat the parenthesis as a end of the JSON raw data.

Minimal code example

`json test = R"({ "a": "b)"})"_json;`

Error messages

The errors are similar to when you forgot to close a string or simililar. All the code below the above example gives sintax error. Even the Visual Studio Code intellisense starts to work wrongly and the formatter breaks the format of the json.

Compiler and operating system

Microsoft (R) Build Engine versión 17.1.0+ae57d105c para .NET Framework on Windows 11

Library version

3.10.5

Validation

@falbrechtskirchinger
Copy link
Contributor

falbrechtskirchinger commented Aug 6, 2022

See https://en.cppreference.com/w/cpp/language/string_literal.

This works as expected. Use a delimiter sequence.

(Please open a discussion for support requests in the future.)

@Danixu
Copy link
Author

Danixu commented Aug 6, 2022

I see, thanks!!

@Danixu Danixu closed this as completed Aug 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants