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++/49520] [C++0x] using-declaration and operator&& confuses constexpr


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

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-06-24 10:22:03 UTC ---
It works fine if:

* the return statement is just a noexcept-expression

* the using-declaration is moved to namespace-scope

* the using-declaration is removed and the call is qualified as 'x::foo()'

or several other variations.

I can use this workaround, but IIUC it shouldn't be necessary:

namespace x { void foo(); }

template<typename T>
struct traits
{
    static constexpr bool f() { return true; }

    static constexpr bool g()
    {
        using x::foo;
        return noexcept(foo());
    }

    static constexpr bool h()
    { return f() && g(); }
};

template struct traits<int>;


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