- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I've been having trouble with multi-line raw string literals. This small program will illustrate:
#include <iostream>
#include <string>
using namespace std;
#pragma warning(disable : 1345)
const string grammar = R"!(
tokens
<comment> : template = <slash_prefix_comment>
rules
E ::= E '+' T | T
T ::= T '*' F | F
F ::= <number> | '(' E ')'
$)!";
#pragma warning(default : 1345)
int main()
{
for (auto c: grammar)
{
cout << c << " " << static_cast<int>(c) << endl;
}
}
The pragma is to stop a warning about unterminated string literals. I don't think I should be getting that but I can live with the pragma. The last character to print here should be '$', but with version 14 of the compiler I get a few characters of junk instead of the '$'. With longer literals much more can be cut off. I gather this feature is intended for regex expressions but I'm trying to use it for something like a `here document', which would be longer. I think that should work too. Am I missing something?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You're correct, it's a compiler bug. Is your host Windows or Linux?
It appears to be DPD200249078 in our internal bugs database. DPD200249078 has been fixed so it should be in the next update.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You're correct, it's a compiler bug. Is your host Windows or Linux?
It appears to be DPD200249078 in our internal bugs database. DPD200249078 has been fixed so it should be in the next update.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm using Windows. Thanks a lot for your help. I'll be looking forward to the next update.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page