[Bug c++/55003] [C++11] Member function pointer not working as constexpr initializer

daniel.kruegler at googlemail dot com gcc-bugzilla@gcc.gnu.org
Sun Oct 21 13:37:00 GMT 2012


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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |daniel.kruegler at
                   |                            |googlemail dot com

--- Comment #1 from Daniel Krügler <daniel.kruegler at googlemail dot com> 2012-10-21 13:36:28 UTC ---
The code presented code example seems incomplete, because it is accepted as
written. Here a complete code-example compiled with gcc 4.8.0 20121014
(experimental) using the compiler flags

-Wall -std=c++11 -pedantic

//---------------------
template<typename T>
struct MemberGet{
   static constexpr auto assign_operator =
   static_cast<T & (T::*)(const T &)>(&T::operator=);
};

struct X {};

MemberGet<X> mg;
//---------------------

"3|error: declaration of 'constexpr const auto MemberGet<X>::assign_operator'
has no initializer|"

I agree that this code should be accepted.



More information about the Gcc-bugs mailing list