2023-07-04 19:40:48 +02:00
|
|
|
|
//@ edition: 2021
|
|
|
|
|
|
2023-12-07 09:53:08 +11:00
|
|
|
|
// The null char check for C string literals was originally implemented after
|
|
|
|
|
// expansion, which meant the first five strings in this file triggered errors,
|
|
|
|
|
// and the remaining ten did not. But this is different to all the other
|
|
|
|
|
// content checks done on string literals, such as checks for invalid escapes
|
|
|
|
|
// and bare CR chars. So the check was moved earlier. The check can be moved
|
|
|
|
|
// back to after expansion at a later date if necessary, because that would be
|
|
|
|
|
// a backward compatible change. (In contrast, moving the check from after
|
|
|
|
|
// expansion to lexing time would be a backward incompatible change, because it
|
|
|
|
|
// could break code that was previously accepted.)
|
2023-03-06 07:10:23 +00:00
|
|
|
|
|
2023-12-07 09:53:08 +11:00
|
|
|
|
fn main() {
|
|
|
|
|
c"\0"; //~ ERROR null characters in C string literals
|
|
|
|
|
c"\u{00}"; //~ ERROR null characters in C string literals
|
|
|
|
|
c" |