[Bug c++/29273] New: error on dynamic_cast<T>(array)

sebor at roguewave dot com gcc-bugzilla@gcc.gnu.org
Thu Sep 28 16:08:00 GMT 2006


Gcc gives an error for the dynamic_cast below. During the discussion of bug
29185 with EDG it turned out that according to 5, p8, the code is well-formed
and should not be diagnosed.

$ cat t.cpp && gcc t.cpp
struct A { virtual ~A () { } };
struct B: A { } b [1];

void foo ()
{
    dynamic_cast<B*>(b);
}
t.cpp: In function 'void foo()':
t.cpp:6: error: cannot dynamic_cast 'b' (of type 'struct B [1]') to type
'struct B*' (source is not a pointer)


-- 
           Summary: error on dynamic_cast<T>(array)
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: sebor at roguewave dot com
 GCC build triplet: all
  GCC host triplet: all
GCC target triplet: all


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



More information about the Gcc-bugs mailing list