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 c++/61057] [C++11] operator . considered part of User Defined Literal invocation.


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.


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