public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/55003] New: [C++11] Member function pointer not working as constexpr initializer
@ 2012-10-20 22:13 lee.mcculler at gmail dot com
  2012-10-21 13:37 ` [Bug c++/55003] " daniel.kruegler at googlemail dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: lee.mcculler at gmail dot com @ 2012-10-20 22:13 UTC (permalink / raw)
  To: gcc-bugs


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

             Bug #: 55003
           Summary: [C++11] Member function pointer not working as
                    constexpr initializer
    Classification: Unclassified
           Product: gcc
           Version: 4.7.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: lee.mcculler@gmail.com


This piece of code 

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

fails with this error:

error: declaration of ‘constexpr const auto
MemberGet<fpga::FPGAFilter>::assign_operator’ has no initializer

on with gcc -v:
Using built-in specs.
COLLECT_GCC=/usr/bin/g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.2/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: /build/src/gcc-4.7.2/configure --prefix=/usr --libdir=/usr/lib
--libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info
--with-bugurl=https://bugs.archlinux.org/
--enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++ --enable-shared
--enable-threads=posix --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-clocale=gnu --disable-libstdcxx-pch
--enable-libstdcxx-time --enable-gnu-unique-object --enable-linker-build-id
--with-ppl --enable-cloog-backend=isl --disable-ppl-version-check
--disable-cloog-version-check --enable-lto --enable-gold --enable-ld=default
--enable-plugin --with-plugin-ld=ld.gold --with-linker-hash-style=gnu
--enable-multilib --disable-libssp --disable-build-with-cxx
--disable-build-poststage1-with-cxx --enable-checking=release
Thread model: posix
gcc version 4.7.2 (GCC)


I'm pretty certain that this code is valid C++ as it does compile in clang++
(built on top of this gcc version).


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

* [Bug c++/55003] [C++11] Member function pointer not working as constexpr initializer
  2012-10-20 22:13 [Bug c++/55003] New: [C++11] Member function pointer not working as constexpr initializer lee.mcculler at gmail dot com
@ 2012-10-21 13:37 ` daniel.kruegler at googlemail dot com
  2012-11-07 16:12 ` paolo.carlini at oracle dot com
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: daniel.kruegler at googlemail dot com @ 2012-10-21 13:37 UTC (permalink / raw)
  To: gcc-bugs


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.


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

* [Bug c++/55003] [C++11] Member function pointer not working as constexpr initializer
  2012-10-20 22:13 [Bug c++/55003] New: [C++11] Member function pointer not working as constexpr initializer lee.mcculler at gmail dot com
  2012-10-21 13:37 ` [Bug c++/55003] " daniel.kruegler at googlemail dot com
@ 2012-11-07 16:12 ` paolo.carlini at oracle dot com
  2013-02-15  1:28 ` jason at gcc dot gnu.org
  2013-02-15 11:24 ` paolo.carlini at oracle dot com
  3 siblings, 0 replies; 5+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-11-07 16:12 UTC (permalink / raw)
  To: gcc-bugs


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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |supercilious.dude at gmail
                   |                            |dot com

--- Comment #2 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-11-07 16:11:28 UTC ---
*** Bug 55159 has been marked as a duplicate of this bug. ***


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

* [Bug c++/55003] [C++11] Member function pointer not working as constexpr initializer
  2012-10-20 22:13 [Bug c++/55003] New: [C++11] Member function pointer not working as constexpr initializer lee.mcculler at gmail dot com
  2012-10-21 13:37 ` [Bug c++/55003] " daniel.kruegler at googlemail dot com
  2012-11-07 16:12 ` paolo.carlini at oracle dot com
@ 2013-02-15  1:28 ` jason at gcc dot gnu.org
  2013-02-15 11:24 ` paolo.carlini at oracle dot com
  3 siblings, 0 replies; 5+ messages in thread
From: jason at gcc dot gnu.org @ 2013-02-15  1:28 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #3 from Jason Merrill <jason at gcc dot gnu.org> 2013-02-15 01:27:44 UTC ---
Author: jason
Date: Fri Feb 15 01:27:36 2013
New Revision: 196069

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=196069
Log:
    PR c++/55003
    * decl.c (cp_finish_decl): Force instantiation of an
    auto static data member.

Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/auto37.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/decl.c


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

* [Bug c++/55003] [C++11] Member function pointer not working as constexpr initializer
  2012-10-20 22:13 [Bug c++/55003] New: [C++11] Member function pointer not working as constexpr initializer lee.mcculler at gmail dot com
                   ` (2 preceding siblings ...)
  2013-02-15  1:28 ` jason at gcc dot gnu.org
@ 2013-02-15 11:24 ` paolo.carlini at oracle dot com
  3 siblings, 0 replies; 5+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-02-15 11:24 UTC (permalink / raw)
  To: gcc-bugs


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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.8.0

--- Comment #4 from Paolo Carlini <paolo.carlini at oracle dot com> 2013-02-15 11:24:22 UTC ---
Fixed.


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

end of thread, other threads:[~2013-02-15 11:24 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-20 22:13 [Bug c++/55003] New: [C++11] Member function pointer not working as constexpr initializer lee.mcculler at gmail dot com
2012-10-21 13:37 ` [Bug c++/55003] " daniel.kruegler at googlemail dot com
2012-11-07 16:12 ` paolo.carlini at oracle dot com
2013-02-15  1:28 ` jason at gcc dot gnu.org
2013-02-15 11:24 ` paolo.carlini at oracle dot com

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).