|
Boost : |
From: Chris Little (cslittle_at_[hidden])
Date: 2004-06-15 07:47:37
on 6/14/04 1:18 PM, Joaquín Mª López Muñoz at joaquin_at_[hidden] wrote:
> During the porting of my library, I found the following compiler
> bug in CW 8.3:
>
> **BEGIN PROGRAM**
> #include <iostream>
>
> struct foo
> {
> foo(){}
> foo(const foo&){}
> ~foo()
> {
> std::cout<<"~foo"<<std::endl;
> }
> };
>
> template<typename T>
> struct A
> {
> static void bar()
> {
> const foo& f=foo();
> std::cout<<"inside A::bar"<<std::endl;
> }
> };
>
> struct B
> {
> static void bar()
> {
> const foo& f=foo();
> std::cout<<"inside B::bar"<<std::endl;
> }
> };
>
> int main()
> {
> std::cout<<"calling A::bar"<<std::endl;
> A<int>::bar();
> std::cout<<"calling B::bar"<<std::endl;
> B::bar();
>
> return 0;
> }
>
> **END PROGRAM**
>
> *Without* enabling the option "ISO C++ Template Parser", everything
> works dandy and the program output is:
>
> calling A::bar
> inside A::bar
> ~foo
> calling B::bar
> inside B::bar
> ~foo
>
I get this output when I build your test app with "ISO C++ Template Parser"
under CWP 9.2.
Chris
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk