public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/61057] New: [C++11] operator . considered part of User Defined Literal invocation.
@ 2014-05-04 18:18 isupeene at ualberta dot ca
  2014-05-04 20:25 ` [Bug c++/61057] " redi at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: isupeene at ualberta dot ca @ 2014-05-04 18:18 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 61057
           Summary: [C++11] operator . considered part of User Defined
                    Literal invocation.
           Product: gcc
           Version: 4.8.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: isupeene at ualberta dot ca

Created attachment 32730
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=32730&action=edit
Contains udl_bug.cpp and udl_bug_workaround.cpp

When compiling with 'g++ -std=c++11 <filename>':

The attached file udl_bug.cpp reproduces the bug, producing the error: "error:
unable to find numeric literal operator ‘operator"" _i.m_value’".

The attached file udl_bug_workaround.cpp compiles successfully and produces the
expected output.
>From gcc-bugs-return-450518-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Sun May 04 18:54:10 2014
Return-Path: <gcc-bugs-return-450518-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 4498 invoked by alias); 4 May 2014 18:54:08 -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 4471 invoked by uid 48); 4 May 2014 18:54:05 -0000
From: "megahallon at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug preprocessor/60014] Bad warning suppression caused by track-macro-expansion when not using integrated cpp
Date: Sun, 04 May 2014 18:54:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: preprocessor
X-Bugzilla-Version: 4.8.2
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: megahallon at gmail dot com
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-60014-4-T0ZS6SdlPK@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-60014-4@http.gcc.gnu.org/bugzilla/>
References: <bug-60014-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/msg00210.txt.bz2
Content-length: 153

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

--- Comment #1 from Fredrik Hallenberg <megahallon at gmail dot com> ---
Same results with gcc 4.9.0


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

* [Bug c++/61057] [C++11] operator . considered part of User Defined Literal invocation.
  2014-05-04 18:18 [Bug c++/61057] New: [C++11] operator . considered part of User Defined Literal invocation isupeene at ualberta dot ca
@ 2014-05-04 20:25 ` redi at gcc dot gnu.org
  2014-07-09 15:58 ` emsr at gcc dot gnu.org
  2014-07-09 16:04 ` emsr at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: redi at gcc dot gnu.org @ 2014-05-04 20:25 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |emsr at gcc dot gnu.org

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Reduced:

class Int {
public:
    constexpr Int(long long unsigned value)
        : m_value(value)
    {}
    const long long unsigned m_value;
};

constexpr Int operator "" _i(long long unsigned i) {
    return Int(i);
}

auto x = 1_i.m_value;

I think G++ is correct, the grammar in the standard defines 1_i.m_value as a
pp-number, i.e. a single preprocessing token, which is treated as a literal, so
_i.m_value is looked up as the suffix.

Clang gives the same error.


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

* [Bug c++/61057] [C++11] operator . considered part of User Defined Literal invocation.
  2014-05-04 18:18 [Bug c++/61057] New: [C++11] operator . considered part of User Defined Literal invocation isupeene at ualberta dot ca
  2014-05-04 20:25 ` [Bug c++/61057] " redi at gcc dot gnu.org
@ 2014-07-09 15:58 ` emsr at gcc dot gnu.org
  2014-07-09 16:04 ` emsr at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: emsr at gcc dot gnu.org @ 2014-07-09 15:58 UTC (permalink / raw)
  To: gcc-bugs

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

emsr at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |INVALID

--- Comment #2 from emsr at gcc dot gnu.org ---
As someone who has dabbled in Ruby I am sympathetic to the request to have this
work.  After looking at the standard language and our implementation I must
conclude that your code is invalid.  I then tried to imagine a way, for
example, if the stuff after a dot could not be a mantissa stop processing chars
at the dot so the remainder can become an invocation or access.  Unfortunately,
123. is a valid double so this idea can't work even as an extension.

FWIW, character and string user-defined literals can have invocations like
"Hello, World!!!"s.length().

Perhaps two dots could signal a termination of a literal as was tried for '_'
as digit separator.  This would require much noodling by the standards folks
though.

I'll ponder this last idea but I'll mark this as resolved invalid.


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

* [Bug c++/61057] [C++11] operator . considered part of User Defined Literal invocation.
  2014-05-04 18:18 [Bug c++/61057] New: [C++11] operator . considered part of User Defined Literal invocation isupeene at ualberta dot ca
  2014-05-04 20:25 ` [Bug c++/61057] " redi at gcc dot gnu.org
  2014-07-09 15:58 ` emsr at gcc dot gnu.org
@ 2014-07-09 16:04 ` emsr at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: emsr at gcc dot gnu.org @ 2014-07-09 16:04 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from emsr at gcc dot gnu.org ---
Leaving a space before the dot also works.


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

end of thread, other threads:[~2014-07-09 16:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-04 18:18 [Bug c++/61057] New: [C++11] operator . considered part of User Defined Literal invocation isupeene at ualberta dot ca
2014-05-04 20:25 ` [Bug c++/61057] " redi at gcc dot gnu.org
2014-07-09 15:58 ` emsr at gcc dot gnu.org
2014-07-09 16:04 ` 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).