39 lines
1.3 KiB
Diff
39 lines
1.3 KiB
Diff
2016-02-03 Jakub Jelinek <jakub@redhat.com>
|
|
|
|
PR c++/69628
|
|
* charset.c (cpp_interpret_charconst): Clear *PCHARS_SEEN
|
|
and *UNSIGNEDP if bailing out early due to errors.
|
|
|
|
* g++.dg/parse/pr69628.C: New test.
|
|
|
|
--- libcpp/charset.c.jj 2016-01-04 15:14:08.000000000 +0100
|
|
+++ libcpp/charset.c 2016-02-03 13:44:05.100120898 +0100
|
|
@@ -1620,10 +1620,17 @@ cpp_interpret_charconst (cpp_reader *pfi
|
|
if (token->val.str.len == (size_t) (2 + wide + u8))
|
|
{
|
|
cpp_error (pfile, CPP_DL_ERROR, "empty character constant");
|
|
+ *pchars_seen = 0;
|
|
+ *unsignedp = 0;
|
|
+ return 0;
|
|
+ }
|
|
+ else if (!cpp_interpret_string (pfile, &token->val.str, 1, &str,
|
|
+ token->type))
|
|
+ {
|
|
+ *pchars_seen = 0;
|
|
+ *unsignedp = 0;
|
|
return 0;
|
|
}
|
|
- else if (!cpp_interpret_string (pfile, &token->val.str, 1, &str, token->type))
|
|
- return 0;
|
|
|
|
if (wide)
|
|
result = wide_str_to_charconst (pfile, str, pchars_seen, unsignedp,
|
|
--- gcc/testsuite/g++.dg/parse/pr69628.C.jj 2016-02-03 13:47:55.300061110 +0100
|
|
+++ gcc/testsuite/g++.dg/parse/pr69628.C 2016-02-03 13:47:32.000000000 +0100
|
|
@@ -0,0 +1,5 @@
|
|
+// PR c++/69628
|
|
+// { dg-do compile }
|
|
+
|
|
+0''; // { dg-error "empty character constant" }
|
|
+// { dg-error "expected unqualified-id before numeric constant" "" { target *-*-* } 4 }
|