public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/55670] New: This isn't a pure virtual method.
@ 2012-12-13  8:16 qufanat at gmail dot com
  2012-12-13 10:33 ` [Bug c++/55670] [C++11] " redi at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: qufanat at gmail dot com @ 2012-12-13  8:16 UTC (permalink / raw)
  To: gcc-bugs


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

             Bug #: 55670
           Summary: This isn't a pure virtual method.
    Classification: Unclassified
           Product: gcc
           Version: 4.7.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: qufanat@gmail.com
            Target: x86_64-linux-gnu
             Build: gcc version 4.7.2 (Ubuntu/Linaro 4.7.2-11precise2)


Created attachment 28944
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=28944
Preprocessed contents of fptest2.cpp

I've been enjoying the new C++11 features in 4.7.  But the combination of
template aliases and non-static data member initialization seems to have caught
a corner-case of pure virtual method parsing.

==== CONTENTS OF fptest.cpp ====
template <class T> using F = T;
struct X {
    F<void ()>* fp = nullptr;
};
int main () { return 0; }
================================

I expected this to compile without error, but instead I got:

==== OUTPUT OF g++-4.7 -std=c++11 fptest.cpp ====
fptest.cpp:3:29: error: invalid pure specifier (only ‘= 0’ is allowed) before
‘;’ token
=================================================

It compiles if I set fp to nullptr in a constructor, and it compiles if I
declare fp with traditional function pointer syntax, " void (* fp ) ()".  It
gives the same error if I initialize fp to the address of a function instead of
nullptr.

Just for kicks, I decided to see what would happen if I tried to initialize fp
to 0.

==== OUTPUT OF g++-4.7 -std=c++11 fptest2.cpp ====
fptest2.cpp:4:1: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.7/README.Bugs> for instructions.
Preprocessed source stored into /tmp/ccjdsX7p.out file, please attach this to
your bugreport.
==================================================

Oh.  Well then.


==== OUTPUT OF g++-4.7 -v ====
Using built-in specs.
COLLECT_GCC=g++-4.7
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.7/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro
4.7.2-11precise2' --with-bugurl=file:///usr/share/doc/gcc-4.7/README.Bugs
--enable-languages=c,c++,go,fortran,objc,obj-c++ --prefix=/usr
--program-suffix=-4.7 --enable-shared --enable-linker-build-id
--with-system-zlib --libexecdir=/usr/lib --without-included-gettext
--enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.7
--libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu
--enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object
--enable-plugin --enable-objc-gc --disable-werror --with-arch-32=i686
--with-abi=m64 --with-multilib-list=m32,m64 --with-tune=generic
--enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu
--target=x86_64-linux-gnu
Thread model: posix
gcc version 4.7.2 (Ubuntu/Linaro 4.7.2-11precise2) 
==============================


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

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

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-13  8:16 [Bug c++/55670] New: This isn't a pure virtual method qufanat at gmail dot com
2012-12-13 10:33 ` [Bug c++/55670] [C++11] " redi at gcc dot gnu.org
2013-02-14  4:31 ` jason at gcc dot gnu.org
2013-02-15 19:31 ` jason at gcc dot gnu.org

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