public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/60209] New: Declaration of user-defined literal operator cause error
@ 2014-02-15  4:29 kariya_mitsuru at hotmail dot com
  2014-02-16 17:30 ` [Bug c++/60209] " daniel.kruegler at googlemail dot com
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: kariya_mitsuru at hotmail dot com @ 2014-02-15  4:29 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 60209
           Summary: Declaration of user-defined literal operator cause
                    error
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: kariya_mitsuru at hotmail dot com

I think that the sample code below should be compiled successfully.

void operator "" "" _x(unsigned long long);

According to C++11 standard 2.2[lex.phases], string literal concatenation
occurs in compilation phase 6 and syntax analysis is performed in compilation
phase 7.


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

* [Bug c++/60209] Declaration of user-defined literal operator cause error
  2014-02-15  4:29 [Bug c++/60209] New: Declaration of user-defined literal operator cause error kariya_mitsuru at hotmail dot com
@ 2014-02-16 17:30 ` daniel.kruegler at googlemail dot com
  2014-05-11 14:44 ` paolo.carlini at oracle dot com
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: daniel.kruegler at googlemail dot com @ 2014-02-16 17:30 UTC (permalink / raw)
  To: gcc-bugs

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

Daniel Krügler <daniel.kruegler at googlemail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |daniel.kruegler@googlemail.
                   |                            |com

--- Comment #1 from Daniel Krügler <daniel.kruegler at googlemail dot com> ---
My understanding is that CWG 1473 clarified this:

http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1473
>From gcc-bugs-return-443839-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Sun Feb 16 17:36:21 2014
Return-Path: <gcc-bugs-return-443839-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 5143 invoked by alias); 16 Feb 2014 17:36:20 -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 5116 invoked by uid 48); 16 Feb 2014 17:36:17 -0000
From: "reichelt at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/60226] New: ICE initializing array of elements with too large alignment
Date: Sun, 16 Feb 2014 17:36:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: new
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c
X-Bugzilla-Version: 4.9.0
X-Bugzilla-Keywords: error-recovery, ice-on-invalid-code
X-Bugzilla-Severity: normal
X-Bugzilla-Who: reichelt 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: bug_id short_desc product version bug_status keywords bug_severity priority component assigned_to reporter
Message-ID: <bug-60226-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-02/txt/msg01596.txt.bz2
Content-length: 1795

http://gcc.gnu.org/bugzilla/show_bug.cgi?id`226

            Bug ID: 60226
           Summary: ICE initializing array of elements with too large
                    alignment
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Keywords: error-recovery, ice-on-invalid-code
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: reichelt at gcc dot gnu.org

The following invalid code snippet triggers an ICE since GCC 4.0.0:

======================================================typedef int __attribute__ ((aligned(1 << 28))) int28;
int28 foo[4] = {};
======================================================
bug.c:2:1: error: alignment of array elements is greater than element size
 int28 foo[4] = {};
 ^
bug.c:2:1: internal compiler error: in round_up_loc, at fold-const.c:16882
0x7e8116 round_up_loc(unsigned int, tree_node*, int)
        ../../gcc/gcc/fold-const.c:16882
0x9e45bd finalize_type_size
        ../../gcc/gcc/stor-layout.c:1691
0x9e6936 layout_type(tree_node*)
        ../../gcc/gcc/stor-layout.c:2312
0xc0e1a2 build_array_type_1
        ../../gcc/gcc/tree.c:7840
0x5961e0 grokdeclarator
        ../../gcc/gcc/c/c-decl.c:5603
0x598c6d start_decl(c_declarator*, c_declspecs*, bool, tree_node*)
        ../../gcc/gcc/c/c-decl.c:4069
0x5e88ff c_parser_declaration_or_fndef
        ../../gcc/gcc/c/c-parser.c:1754
0x5eca5f c_parser_external_declaration
        ../../gcc/gcc/c/c-parser.c:1399
0x5ed359 c_parser_translation_unit
        ../../gcc/gcc/c/c-parser.c:1286
0x5ed359 c_parse_file()
        ../../gcc/gcc/c/c-parser.c:14026
0x63bc53 c_common_parse_file()
        ../../gcc/gcc/c-family/c-opts.c:1060
Please submit a full bug report, [etc.]


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

* [Bug c++/60209] Declaration of user-defined literal operator cause error
  2014-02-15  4:29 [Bug c++/60209] New: Declaration of user-defined literal operator cause error kariya_mitsuru at hotmail dot com
  2014-02-16 17:30 ` [Bug c++/60209] " daniel.kruegler at googlemail dot com
@ 2014-05-11 14:44 ` paolo.carlini at oracle dot com
  2014-05-12 13:52 ` emsr at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: paolo.carlini at oracle dot com @ 2014-05-11 14:44 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

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


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

* [Bug c++/60209] Declaration of user-defined literal operator cause error
  2014-02-15  4:29 [Bug c++/60209] New: Declaration of user-defined literal operator cause error kariya_mitsuru at hotmail dot com
  2014-02-16 17:30 ` [Bug c++/60209] " daniel.kruegler at googlemail dot com
  2014-05-11 14:44 ` paolo.carlini at oracle dot com
@ 2014-05-12 13:52 ` emsr at gcc dot gnu.org
  2014-05-12 13:54 ` emsr at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: emsr at gcc dot gnu.org @ 2014-05-12 13:52 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from emsr at gcc dot gnu.org ---
Created attachment 32779
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=32779&action=edit
Just parse a whole string instread of consuming one token.

This builds and tests clean on x86_64-linux.

I would like to hold out for a slightly better design that could simplifiy code
a tiny bit and handle maybe these:

void operator "" "" _x(unsigned long long); // This patch diagnoses this.

void operator "" "boo" _y(unsigned long long); // I'd like to diagnose this.

void operator "" u"" _u(unsigned long long); // I'd like to diagnose this.

void operator u"" "" _v(unsigned long long); // Diagnosed correctly now.

void operator "" ""_w(unsigned long long); // This might be harder/messier and
may be out of scope.


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

* [Bug c++/60209] Declaration of user-defined literal operator cause error
  2014-02-15  4:29 [Bug c++/60209] New: Declaration of user-defined literal operator cause error kariya_mitsuru at hotmail dot com
                   ` (2 preceding siblings ...)
  2014-05-12 13:52 ` emsr at gcc dot gnu.org
@ 2014-05-12 13:54 ` emsr at gcc dot gnu.org
  2014-07-13 13:37 ` emsr at gcc dot gnu.org
  2014-07-13 13:40 ` emsr at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: emsr at gcc dot gnu.org @ 2014-05-12 13:54 UTC (permalink / raw)
  To: gcc-bugs

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

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 32780
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=32780&action=edit
attach patch for previous message...


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

* [Bug c++/60209] Declaration of user-defined literal operator cause error
  2014-02-15  4:29 [Bug c++/60209] New: Declaration of user-defined literal operator cause error kariya_mitsuru at hotmail dot com
                   ` (3 preceding siblings ...)
  2014-05-12 13:54 ` emsr at gcc dot gnu.org
@ 2014-07-13 13:37 ` emsr at gcc dot gnu.org
  2014-07-13 13:40 ` emsr at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: emsr at gcc dot gnu.org @ 2014-07-13 13:37 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from emsr at gcc dot gnu.org ---
Author: emsr
Date: Sun Jul 13 13:36:57 2014
New Revision: 212494

URL: https://gcc.gnu.org/viewcvs?rev=212494&root=gcc&view=rev
Log:
cp/

2014-07-13  Edward Smith-Rowland  <3dw4rd@verizon.net>

    PR C++/60209 - Declaration of user-defined literal operator cause error
    * cp/parser.c (cp_parser_operator()): Fold treatment of strings
    and user-defined string literals.  Use the full string parser.
    (cp_parser_string_literal()): Add flag to not look for literal operator.


testsuite/

2014-07-13  Edward Smith-Rowland  <3dw4rd@verizon.net>

    PR C++/60209 - Declaration of user-defined literal operator cause error
    * g++.dg/cpp0x/pr60209-neg.C: New.
    * g++.dg/cpp0x/pr60209.C: New.
    * g++.dg/cpp1y/udlit-empty-string-neg.C: Adjust messages.


Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/pr60209-neg.C
    trunk/gcc/testsuite/g++.dg/cpp0x/pr60209.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/parser.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/g++.dg/cpp1y/udlit-empty-string-neg.C


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

* [Bug c++/60209] Declaration of user-defined literal operator cause error
  2014-02-15  4:29 [Bug c++/60209] New: Declaration of user-defined literal operator cause error kariya_mitsuru at hotmail dot com
                   ` (4 preceding siblings ...)
  2014-07-13 13:37 ` emsr at gcc dot gnu.org
@ 2014-07-13 13:40 ` emsr at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: emsr at gcc dot gnu.org @ 2014-07-13 13:40 UTC (permalink / raw)
  To: gcc-bugs

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

emsr at gcc dot gnu.org changed:

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

--- Comment #6 from emsr at gcc dot gnu.org ---
Fixed on trunk.


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

end of thread, other threads:[~2014-07-13 13:40 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-15  4:29 [Bug c++/60209] New: Declaration of user-defined literal operator cause error kariya_mitsuru at hotmail dot com
2014-02-16 17:30 ` [Bug c++/60209] " daniel.kruegler at googlemail dot com
2014-05-11 14:44 ` paolo.carlini at oracle dot com
2014-05-12 13:52 ` emsr at gcc dot gnu.org
2014-05-12 13:54 ` emsr at gcc dot gnu.org
2014-07-13 13:37 ` emsr at gcc dot gnu.org
2014-07-13 13:40 ` 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).