From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31244 invoked by alias); 6 Dec 2007 19:53:16 -0000 Received: (qmail 31122 invoked by uid 48); 6 Dec 2007 19:52:59 -0000 Date: Thu, 06 Dec 2007 19:53:00 -0000 Subject: [Bug c++/34364] New: [4.1/4.2/4.3] class& is not known as as a class-type anymore after dynamic_cast X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "rbuergel at web dot de" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2007-12/txt/msg00473.txt.bz2 The following code fails to compile struct A { virtual ~A() {}; //make A polymorphic }; struct B: public A { template class C { public: static void f (A& a) { dynamic_cast( a ).g(); } }; void g () {} }; ... and issues the following Error message: test.cpp: In static member function 'static void B::Update::g(A&)': test.cpp:21: error: request for member 'g' in 'dynamic_cast(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