public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/56104] New: Wrong "dereferencing type-punned pointer" warning
@ 2013-01-25 10:50 joerg.richter@pdv-fs.de
  2013-01-25 13:04 ` [Bug c++/56104] " daniel.kruegler at googlemail dot com
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: joerg.richter@pdv-fs.de @ 2013-01-25 10:50 UTC (permalink / raw)
  To: gcc-bugs


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

             Bug #: 56104
           Summary: Wrong "dereferencing type-punned pointer" warning
    Classification: Unclassified
           Product: gcc
           Version: 4.7.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: joerg.richter@pdv-fs.de


cat > t.cc <<EOF
struct Foo
{
    void call()
    {}
};

template<class MEMSIG, MEMSIG MEMFUNC>
struct Wrap
{
    inline static void call( Foo cc )
    {
      (cc.*MEMFUNC)();     // <- warning here
    }
};

void bar()
{
  Wrap<void (Foo::*)(), &Foo::call>::call( Foo() );
}
EOF

/tools/pkg/gcc/4.7.2/bin/g++ -Wall -O2 -c -o t.o t.cc


Outputs:
t.cc: In instantiation of 'static void Wrap<MEMSIG, MEMFUNC>::call(Foo) [with
MEMSIG = void (Foo::*)(); MEMSIG MEMFUNC = &Foo::call]':
t.cc:18:38:   required from here
t.cc:12:7: warning: dereferencing type-punned pointer will break
strict-aliasing rules [-Wstrict-aliasing]

I think this warning is wrong.


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

end of thread, other threads:[~2013-01-31 16:35 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-25 10:50 [Bug c++/56104] New: Wrong "dereferencing type-punned pointer" warning joerg.richter@pdv-fs.de
2013-01-25 13:04 ` [Bug c++/56104] " daniel.kruegler at googlemail dot com
2013-01-25 14:36 ` [Bug c++/56104] [4.7/4.8 Regression] " jakub at gcc dot gnu.org
2013-01-25 14:58 ` jakub at gcc dot gnu.org
2013-01-25 15:06 ` jakub at gcc dot gnu.org
2013-01-25 15:32 ` jason at gcc dot gnu.org
2013-01-25 17:56 ` jason at gcc dot gnu.org
2013-01-25 20:27 ` jason at gcc dot gnu.org
2013-01-25 20:29 ` jason at gcc dot gnu.org
2013-01-31 16:35 ` 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).