diff options
author | emsr <emsr@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-02-14 02:55:42 +0000 |
---|---|---|
committer | emsr <emsr@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-02-14 02:55:42 +0000 |
commit | 911b08c636a42ef9995ce850b4337620e85b14c8 (patch) | |
tree | 835d414e4efbc7f21d5a4f16cd4e2d5968134664 /libcpp | |
parent | b40995728da42ed2042151d14015e7f854504712 (diff) | |
download | gcc-911b08c636a42ef9995ce850b4337620e85b14c8.tar.gz |
gcc/libcpp/
2013-02-13 Ed Smith-Rowland <3dw4rd@verizon.net>
PR c++/55582
* libcpp/lex.c (lex_raw_string): Allow string literal with suffix
beginning with 's' to be parsed as a C++11 user-defined literal.
gcc/testsuite/
2013-02-13 Ed Smith-Rowland <3dw4rd@verizon.net>
PR c++/55582
* g++.dg/cpp0x/udlit-string-literal.h: New.
* g++.dg/cpp0x/udlit-string-literal.C: New.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@196041 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libcpp')
-rw-r--r-- | libcpp/ChangeLog | 6 | ||||
-rw-r--r-- | libcpp/lex.c | 16 |
2 files changed, 16 insertions, 6 deletions
diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog index aa6a02d91f9..22451a2103f 100644 --- a/libcpp/ChangeLog +++ b/libcpp/ChangeLog @@ -1,3 +1,9 @@ +2013-02-13 Ed Smith-Rowland <3dw4rd@verizon.net> + + PR c++/55582 + * libcpp/lex.c (lex_raw_string): Allow string literal with suffix + beginning with 's' to be parsed as a C++11 user-defined literal. + 2013-01-14 Richard Sandiford <rdsandiford@googlemail.com> Update copyright years. diff --git a/libcpp/lex.c b/libcpp/lex.c index aa87da95323..976d9e8b0eb 100644 --- a/libcpp/lex.c +++ b/libcpp/lex.c @@ -1561,8 +1561,10 @@ lex_raw_string (cpp_reader *pfile, cpp_token *token, const uchar *base, from inttypes.h, we generate a warning and treat the ud-suffix as a separate preprocessing token. This approach is under discussion by the standards committee, and has been adopted as a conforming - extension by other front ends such as clang. */ - if (ISALPHA (*cur)) + extension by other front ends such as clang. + A special exception is made for the suffix 's' which will be + standardized as a user-defined literal suffix for strings. */ + if (ISALPHA (*cur) && *cur != 's') { /* Raise a warning, but do not consume subsequent tokens. */ if (CPP_OPTION (pfile, warn_literal_suffix)) @@ -1572,7 +1574,7 @@ lex_raw_string (cpp_reader *pfile, cpp_token *token, const uchar *base, "a space between literal and identifier"); } /* Grab user defined literal suffix. */ - else if (*cur == '_') + else if (ISIDST (*cur)) { type = cpp_userdef_string_add_type (type); ++cur; @@ -1692,8 +1694,10 @@ lex_string (cpp_reader *pfile, cpp_token *token, const uchar *base) from inttypes.h, we generate a warning and treat the ud-suffix as a separate preprocessing token. This approach is under discussion by the standards committee, and has been adopted as a conforming - extension by other front ends such as clang. */ - if (ISALPHA (*cur)) + extension by other front ends such as clang. + A special exception is made for the suffix 's' which will be + standardized as a user-defined literal suffix for strings. */ + if (ISALPHA (*cur) && *cur != 's') { /* Raise a warning, but do not consume subsequent tokens. */ if (CPP_OPTION (pfile, warn_literal_suffix)) @@ -1703,7 +1707,7 @@ lex_string (cpp_reader *pfile, cpp_token *token, const uchar *base) "a space between literal and identifier"); } /* Grab user defined literal suffix. */ - else if (*cur == '_') + else if (ISIDST (*cur)) { type = cpp_userdef_char_add_type (type); type = cpp_userdef_string_add_type (type); |