dynamic_cast<T>(v) fails for T qualified from global namespace

Nathan Sidwell nathan@codesourcery.com
Fri Aug 31 02:26:00 GMT 2001


Ben Allan wrote:
> 
> The short program at end here produces error messages under both 2.95.3 and
> 3.x at
> http://www.codesourcery.com/gcc-compile.shtml
> I don't see anything in the c++ spec that disallows globally qualified
> class names for T in dynamic_cast<T>(v); .

> /usr/tmp/@19711.7.cc: In function `int main()':
>       /usr/tmp/@19711.7.cc:37: parse error before `[' token
>       /usr/tmp/@19711.7.cc:42: parse error before `[' token
> 
>   fp2 = dynamic_cast<::n1::foo *>(bp); // ! err
`<:' is a digraph for `[', so you effectively wrote
	dynamic_cast [ : n1 :: foo * > ( bp ) ;

nathan

-- 
Dr Nathan Sidwell   ::   http://www.codesourcery.com   ::   CodeSourcery LLC
         'But that's a lie.' - 'Yes it is. What's your point?'
nathan@codesourcery.com : http://www.cs.bris.ac.uk/~nathan/ : nathan@acm.org



More information about the Gcc-bugs mailing list