This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/49520] [C++0x] using-declaration and operator&& confuses constexpr
- From: "redi at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 24 Jun 2011 10:22:04 +0000
- Subject: [Bug c++/49520] [C++0x] using-declaration and operator&& confuses constexpr
- Auto-submitted: auto-generated
- References: <bug-49520-4@http.gcc.gnu.org/bugzilla/>
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>;