This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug preprocessor/65860] New: Stringification of User Defined Literals


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65860

            Bug ID: 65860
           Summary: Stringification of User Defined Literals
           Product: gcc
           Version: 4.9.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: preprocessor
          Assignee: unassigned at gcc dot gnu.org
          Reporter: marcin.konarski at codestation dot org

Sample session explaining problem with stringification of UDLs.
As you can see if preprocessor is run with -std=c++11 switch
it fails to properly stringify tokens that semantically are
user defined literals.

[amok@vegeta](2/3)~/$ cat s.cxx
#define sr( x ) #x
#define s( x ) sr( x )

s( "13"_udl );

#define SR( ... ) # __VA_ARGS__
#define S( ... ) SR( __VA_ARGS__ )

S( "aaa", 7 > x, "13"_udl, foo( 13 ), "bbb" );

[amok@vegeta](2/3)~/$ cpp -E s.cxx
# 1 "s.cxx"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "/usr/include/stdc-predef.h" 1 3 4
# 1 "<command-line>" 2
# 1 "s.cxx"

"\"13\"_udl";

"\"aaa\", 7 > x, \"13\"_udl, foo( 13 ), \"bbb\"";
[amok@vegeta](2/3)~/$ cpp -E -std=c++11 s.cxx
# 1 "s.cxx"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "/usr/include/stdc-predef.h" 1 3 4
# 1 "<command-line>" 2
# 1 "s.cxx"

""13"_udl";

"\"aaa\", 7 > x, "13"_udl, foo( 13 ), \"bbb\"";
[amok@vegeta](2/3)~/$

I would expect both outputs to be the same.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]