public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/34364]  New: [4.1/4.2/4.3] class& is not known as as a class-type anymore after dynamic_cast
@ 2007-12-06 19:53 rbuergel at web dot de
  2007-12-08 20:23 ` [Bug c++/34364] [4.1/4.2/4.3 Regression] " pinskia at gcc dot gnu dot org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: rbuergel at web dot de @ 2007-12-06 19:53 UTC (permalink / raw)
  To: gcc-bugs

The following code fails to compile
struct A {
    virtual ~A() {}; //make A polymorphic
};

struct B: public A
{
    template <typename T2>
    class C
    {
      public:
          static void f (A& a)
          {
               dynamic_cast<B&>( a ).g();
          }
    };

    void g () {}
};



... and issues the following Error message:

test.cpp: In static member function 'static void B::Update<T2>::g(A&)':
test.cpp:21: error: request for member 'g' in 'dynamic_cast<B&>(a)', which is
of non-class type 'B&'


On the other hand, it works if either C is not a template or B is a template. 

this fails for 4.1.3, 4.2.2 and 4.3.0


-- 
           Summary: [4.1/4.2/4.3] class& is not known as as a class-type
                    anymore after dynamic_cast
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: rbuergel at web dot de


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


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

end of thread, other threads:[~2009-03-31  1:39 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-12-06 19:53 [Bug c++/34364] New: [4.1/4.2/4.3] class& is not known as as a class-type anymore after dynamic_cast rbuergel at web dot de
2007-12-08 20:23 ` [Bug c++/34364] [4.1/4.2/4.3 Regression] " pinskia at gcc dot gnu dot org
2007-12-10 22:20 ` jakub at gcc dot gnu dot org
2007-12-11  8:20 ` jakub at gcc dot gnu dot org
2007-12-11  8:37 ` [Bug c++/34364] [4.1/4.2 " jakub at gcc dot gnu dot org
2008-07-04 22:22 ` [Bug c++/34364] [4.2 " jsm28 at gcc dot gnu dot org
2009-03-31  1:39 ` jsm28 at gcc dot gnu dot 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).