This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Bug: missing endl


Geoffrey Furnish <furnish@actel.com> writes:

> The following looks like a bug to me, discovered in 20000821 snapshot:
> 
> valinux[69] cat y.cc
> #include <iostream>
> 
> namespace A {
> 
>     template<class B>
>     class XYZ {
>       public:
>         void compute();
>     };
> 
>     template<class B>
>     void XYZ<B>::compute()
>     {
>         using namespace std;
> 
>         cout << "Testing." << endl;

cout and endl have been moved into std::.

Try:
          std::cout << "Testing." << std::endl;

or add appropriate using declarations.

>     }
> 
> }
> 
> namespace A {
>     template class XYZ<int>;
> }
> valinux[70] c++ -v -c y.cc
> Reading specs from /va1/furnish/gcc/lib/gcc-lib/i686-pc-linux/2.96/specs
> gcc version 2.96 20000821 (experimental)
>  /va1/furnish/gcc/lib/gcc-lib/i686-pc-linux/2.96/cpp0 -lang-c++ -D__GNUG__=2 -v -D__GNUC__=2 -D__GNUC_MINOR__=96 -D__GNUC_PATCHLEVEL__=0 -D__ELF__ -Dunix -Dlinux -D__ELF__ -D__unix__ -D__linux__ -D__unix -D__linux -Asystem(posix) -Acpu(i386) -Amachine(i386) -Di386 -D__i386 -D__i386__ -D__tune_pentiumpro__ y.cc /tmp/ccaxMWTc.ii
> GNU CPP version 2.96 20000821 (experimental) (cpplib)
>  (i386 Linux/ELF)
> ignoring nonexistent directory "/usr/local/include"
> #include "..." search starts here:
> #include <...> search starts here:
>  /va1/furnish/gcc/include/g++-v3
>  /va1/furnish/gcc/lib/gcc-lib/i686-pc-linux/2.96/include
>  /va1/furnish/gcc/i686-pc-linux/include
>  /usr/include
> End of search list.
>  /va1/furnish/gcc/lib/gcc-lib/i686-pc-linux/2.96/cc1plus /tmp/ccaxMWTc.ii -quiet -dumpbase y.cc -version -o /tmp/cc98EJPi.s
> GNU C++ version 2.96 20000821 (experimental) (i686-pc-linux) compiled by GNU C version 2.96 20000821 (experimental).
> y.cc: In method `void A::XYZ<B>::compute () [with B = int]':
> y.cc:22:   instantiated from here
> y.cc:16: `endl' undeclared (first use this function)
> y.cc:16: (Each undeclared identifier is reported only once for each function it 
> appears in.)
> valinux[71] 
> 
> I don't know if it matters, but this snapshot was configured with
> --enable-libstdcxx-v3 --enable-shared.

It does matter. --enable-libstdcxx-v3 configures the compiler so that
  -fhonor-std is always on, and the standard library so that it is
  nicely wrapped in std::, the way it is supposed to be.


Thank you for your bug report.
[snip]

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]