public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/61038] New: g++ -E is unusable with UDL strings
@ 2014-05-02 20:11 b.r.longbons at gmail dot com
  2014-05-11  9:33 ` [Bug c++/61038] " paolo.carlini at oracle dot com
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: b.r.longbons at gmail dot com @ 2014-05-02 20:11 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=61038

            Bug ID: 61038
           Summary: g++ -E is unusable with UDL strings
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: critical
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: b.r.longbons at gmail dot com

The following program is legal and compiles correctly. However, if preprocessed
only, the .ii file in invalid because it fails to escape the ""s

gcc 4.7, 4.8, and 4.9 all fail. Earlier versions did not support UDLs.

I am marking this as "critical" because it makes reducing testcases for other
bugs very difficult.

// compile with -std=c++11
void operator "" _s(const char *, unsigned long)
{
}

#define QUOTE(s) #s

int main()
{
    QUOTE("hello"_s);
}


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug c++/61038] g++ -E is unusable with UDL strings
  2014-05-02 20:11 [Bug c++/61038] New: g++ -E is unusable with UDL strings b.r.longbons at gmail dot com
@ 2014-05-11  9:33 ` paolo.carlini at oracle dot com
  2014-05-12 14:12 ` emsr at gcc dot gnu.org
                   ` (11 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: paolo.carlini at oracle dot com @ 2014-05-11  9:33 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=61038

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |3dw4rd at verizon dot net

--- Comment #1 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Ed, can you have a look?


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug c++/61038] g++ -E is unusable with UDL strings
  2014-05-02 20:11 [Bug c++/61038] New: g++ -E is unusable with UDL strings b.r.longbons at gmail dot com
  2014-05-11  9:33 ` [Bug c++/61038] " paolo.carlini at oracle dot com
@ 2014-05-12 14:12 ` emsr at gcc dot gnu.org
  2014-05-12 14:12 ` emsr at gcc dot gnu.org
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: emsr at gcc dot gnu.org @ 2014-05-12 14:12 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=61038

--- Comment #2 from emsr at gcc dot gnu.org ---
Created attachment 32781
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=32781&action=edit
g++ -E pr61038.C > pr61038_cxx98.ii

Get preprocessed output in C++98 mode.


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug c++/61038] g++ -E is unusable with UDL strings
  2014-05-02 20:11 [Bug c++/61038] New: g++ -E is unusable with UDL strings b.r.longbons at gmail dot com
  2014-05-11  9:33 ` [Bug c++/61038] " paolo.carlini at oracle dot com
  2014-05-12 14:12 ` emsr at gcc dot gnu.org
@ 2014-05-12 14:12 ` emsr at gcc dot gnu.org
  2014-05-12 14:49 ` emsr at gcc dot gnu.org
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: emsr at gcc dot gnu.org @ 2014-05-12 14:12 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=61038

--- Comment #3 from emsr at gcc dot gnu.org ---
Created attachment 32782
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=32782&action=edit
g++ -std=c++11 -E pr61038.C > pr61038_cxx11.ii

Get preprocessed output in C++11 mode.


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug c++/61038] g++ -E is unusable with UDL strings
  2014-05-02 20:11 [Bug c++/61038] New: g++ -E is unusable with UDL strings b.r.longbons at gmail dot com
                   ` (2 preceding siblings ...)
  2014-05-12 14:12 ` emsr at gcc dot gnu.org
@ 2014-05-12 14:49 ` emsr at gcc dot gnu.org
  2014-05-12 17:59 ` 3dw4rd at verizon dot net
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: emsr at gcc dot gnu.org @ 2014-05-12 14:49 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=61038

emsr at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2014-05-12
           Assignee|unassigned at gcc dot gnu.org      |emsr at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #4 from emsr at gcc dot gnu.org ---
Created attachment 32783
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=32783&action=edit
In libcpp, is stringify_arg, test for user-defined literal strings.

libcpp/

2014-05-12  Edward Smith-Rowland  <3dw4rd@verizon.net>

    PR c++/61038
    * module.c (stringify_arg (cpp_reader *, macro_arg *)):
    Check for user-defined literal strings to escape quotes.

I need testcases.

Also, it just occurred to me that I should test for user-defined *chars* too.

After work...


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug c++/61038] g++ -E is unusable with UDL strings
  2014-05-02 20:11 [Bug c++/61038] New: g++ -E is unusable with UDL strings b.r.longbons at gmail dot com
                   ` (3 preceding siblings ...)
  2014-05-12 14:49 ` emsr at gcc dot gnu.org
@ 2014-05-12 17:59 ` 3dw4rd at verizon dot net
  2014-05-12 18:50 ` paolo.carlini at oracle dot com
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: 3dw4rd at verizon dot net @ 2014-05-12 17:59 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=61038

--- Comment #5 from Ed Smith-Rowland <3dw4rd at verizon dot net> ---
I'm pretty sure I have my arms around this one.
Two questions:
1. Any ideas on how to make testsuite cases?  Any examples of looking at
preprocessed files in the testsuite?

2. Assuming this gets into mainline, how far can we backport?


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug c++/61038] g++ -E is unusable with UDL strings
  2014-05-02 20:11 [Bug c++/61038] New: g++ -E is unusable with UDL strings b.r.longbons at gmail dot com
                   ` (4 preceding siblings ...)
  2014-05-12 17:59 ` 3dw4rd at verizon dot net
@ 2014-05-12 18:50 ` paolo.carlini at oracle dot com
  2014-05-12 21:22 ` 3dw4rd at verizon dot net
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: paolo.carlini at oracle dot com @ 2014-05-12 18:50 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=61038

--- Comment #6 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Please send your patches, questions, etc, about this and the other bug to the
mailing list, with Jason in CC, otherwise we seriously risk unnecessarily
delaying the resolution of the issues.


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug c++/61038] g++ -E is unusable with UDL strings
  2014-05-02 20:11 [Bug c++/61038] New: g++ -E is unusable with UDL strings b.r.longbons at gmail dot com
                   ` (5 preceding siblings ...)
  2014-05-12 18:50 ` paolo.carlini at oracle dot com
@ 2014-05-12 21:22 ` 3dw4rd at verizon dot net
  2014-05-12 21:32 ` b.r.longbons at gmail dot com
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: 3dw4rd at verizon dot net @ 2014-05-12 21:22 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Ed Smith-Rowland <3dw4rd at verizon dot net> ---
Note to self: you DO need to take care of char...

void
operator "" _t(const char)
{
}

#define QUOTE(s) #s

int
main()
{
    QUOTE('"'_t);
    QUOTE('\''_t);
    QUOTE('\\'_t);
}


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug c++/61038] g++ -E is unusable with UDL strings
  2014-05-02 20:11 [Bug c++/61038] New: g++ -E is unusable with UDL strings b.r.longbons at gmail dot com
                   ` (6 preceding siblings ...)
  2014-05-12 21:22 ` 3dw4rd at verizon dot net
@ 2014-05-12 21:32 ` b.r.longbons at gmail dot com
  2014-05-12 21:37 ` daniel.kruegler at googlemail dot com
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: b.r.longbons at gmail dot com @ 2014-05-12 21:32 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Ben Longbons <b.r.longbons at gmail dot com> ---
(In reply to Ed Smith-Rowland from comment #7)
> Note to self: you DO need to take care of char...

What about multi-char constants, or are they not permitted in C++ UDLs?
Normally they get converted to int, so they're not *meaningful*, but ...

Also, remember the different prefixes: L for wchar_t, u8 for char-but-utf8, u
for char16_t, and U for char32_t

unsigned int fourcc = 'ABCD';


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug c++/61038] g++ -E is unusable with UDL strings
  2014-05-02 20:11 [Bug c++/61038] New: g++ -E is unusable with UDL strings b.r.longbons at gmail dot com
                   ` (7 preceding siblings ...)
  2014-05-12 21:32 ` b.r.longbons at gmail dot com
@ 2014-05-12 21:37 ` daniel.kruegler at googlemail dot com
  2014-05-21  0:36 ` emsr at gcc dot gnu.org
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: daniel.kruegler at googlemail dot com @ 2014-05-12 21:37 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from Daniel Krügler <daniel.kruegler at googlemail dot com> ---
(In reply to Ben Longbons from comment #8)
> What about multi-char constants, or are they not permitted in C++ UDLs?
> Normally they get converted to int, so they're not *meaningful*, but ...

There exists a core language issue for this:

http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#1723
>From gcc-bugs-return-451381-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Mon May 12 22:22:27 2014
Return-Path: <gcc-bugs-return-451381-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 23895 invoked by alias); 12 May 2014 22:22:26 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 23789 invoked by uid 48); 12 May 2014 22:22:20 -0000
From: "redi at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/61161] wrong two-stage name lookup for overloaded operators
Date: Mon, 12 May 2014 22:22:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c++
X-Bugzilla-Version: unknown
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: redi at gcc dot gnu.org
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-61161-4-7OpU8RP9rW@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-61161-4@http.gcc.gnu.org/bugzilla/>
References: <bug-61161-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2014-05/txt/msg01073.txt.bz2
Content-length: 144

https://gcc.gnu.org/bugzilla/show_bug.cgi?ida161

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Maybe related to PR51577


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug c++/61038] g++ -E is unusable with UDL strings
  2014-05-02 20:11 [Bug c++/61038] New: g++ -E is unusable with UDL strings b.r.longbons at gmail dot com
                   ` (8 preceding siblings ...)
  2014-05-12 21:37 ` daniel.kruegler at googlemail dot com
@ 2014-05-21  0:36 ` emsr at gcc dot gnu.org
  2014-05-21  0:56 ` emsr at gcc dot gnu.org
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: emsr at gcc dot gnu.org @ 2014-05-21  0:36 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #11 from emsr at gcc dot gnu.org ---
Author: emsr
Date: Wed May 21 00:35:29 2014
New Revision: 210666

URL: http://gcc.gnu.org/viewcvs?rev=210666&root=gcc&view=rev
Log:
gcc/testsuite/

2014-05-20  Edward Smith-Rowland  <3dw4rd@verizon.net>

    PR C++/61038
    * g++.dg/cpp0x/pr61038.C: New.

libcpp/

2014-05-20  Edward Smith-Rowland  <3dw4rd@verizon.net>

    PR C++/61038
    * macro.c (stringify_arg (cpp_reader *, macro_arg *)):
    Check for user-defined literal strings and user-defined literal chars
    to escape necessary characters.


Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/pr61038.C
Modified:
    trunk/gcc/testsuite/ChangeLog
    trunk/libcpp/ChangeLog
    trunk/libcpp/macro.c


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug c++/61038] g++ -E is unusable with UDL strings
  2014-05-02 20:11 [Bug c++/61038] New: g++ -E is unusable with UDL strings b.r.longbons at gmail dot com
                   ` (9 preceding siblings ...)
  2014-05-21  0:36 ` emsr at gcc dot gnu.org
@ 2014-05-21  0:56 ` emsr at gcc dot gnu.org
  2014-06-05 11:12 ` emsr at gcc dot gnu.org
  2014-06-05 11:18 ` emsr at gcc dot gnu.org
  12 siblings, 0 replies; 14+ messages in thread
From: emsr at gcc dot gnu.org @ 2014-05-21  0:56 UTC (permalink / raw)
  To: gcc-bugs

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

emsr at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #12 from emsr at gcc dot gnu.org ---
Closing as fixed.


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug c++/61038] g++ -E is unusable with UDL strings
  2014-05-02 20:11 [Bug c++/61038] New: g++ -E is unusable with UDL strings b.r.longbons at gmail dot com
                   ` (10 preceding siblings ...)
  2014-05-21  0:56 ` emsr at gcc dot gnu.org
@ 2014-06-05 11:12 ` emsr at gcc dot gnu.org
  2014-06-05 11:18 ` emsr at gcc dot gnu.org
  12 siblings, 0 replies; 14+ messages in thread
From: emsr at gcc dot gnu.org @ 2014-06-05 11:12 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #13 from emsr at gcc dot gnu.org ---
Author: emsr
Date: Thu Jun  5 11:12:08 2014
New Revision: 211266

URL: http://gcc.gnu.org/viewcvs?rev=211266&root=gcc&view=rev
Log:
PR c++/61038
I was asked to combine the escape logic for regular chars and strings
with the escape logic for user-defined literals chars and strings.
I just forgot the first time.

Modified:
    trunk/libcpp/macro.c


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug c++/61038] g++ -E is unusable with UDL strings
  2014-05-02 20:11 [Bug c++/61038] New: g++ -E is unusable with UDL strings b.r.longbons at gmail dot com
                   ` (11 preceding siblings ...)
  2014-06-05 11:12 ` emsr at gcc dot gnu.org
@ 2014-06-05 11:18 ` emsr at gcc dot gnu.org
  12 siblings, 0 replies; 14+ messages in thread
From: emsr at gcc dot gnu.org @ 2014-06-05 11:18 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #14 from emsr at gcc dot gnu.org ---
Author: emsr
Date: Thu Jun  5 11:17:25 2014
New Revision: 211267

URL: http://gcc.gnu.org/viewcvs?rev=211267&root=gcc&view=rev
Log:
PR c++/61038
I was asked to combine the escape logic for regular chars and strings
with the escape logic for user-defined literals chars and strings.
I just forgot the first time.

I forgot the ChangeLog!

Modified:
    trunk/libcpp/ChangeLog


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2014-06-05 11:18 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-02 20:11 [Bug c++/61038] New: g++ -E is unusable with UDL strings b.r.longbons at gmail dot com
2014-05-11  9:33 ` [Bug c++/61038] " paolo.carlini at oracle dot com
2014-05-12 14:12 ` emsr at gcc dot gnu.org
2014-05-12 14:12 ` emsr at gcc dot gnu.org
2014-05-12 14:49 ` emsr at gcc dot gnu.org
2014-05-12 17:59 ` 3dw4rd at verizon dot net
2014-05-12 18:50 ` paolo.carlini at oracle dot com
2014-05-12 21:22 ` 3dw4rd at verizon dot net
2014-05-12 21:32 ` b.r.longbons at gmail dot com
2014-05-12 21:37 ` daniel.kruegler at googlemail dot com
2014-05-21  0:36 ` emsr at gcc dot gnu.org
2014-05-21  0:56 ` emsr at gcc dot gnu.org
2014-06-05 11:12 ` emsr at gcc dot gnu.org
2014-06-05 11:18 ` emsr at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).