Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 29 Jun 2003 11:19:02 -0700
From:      "Allan Bowhill" <abowhill@blarg.net>
To:        "fbsd-current" <freebsd-current@freebsd.org>
Subject:   <ftream> errors under g++ 3.2.2
Message-ID:  <013601c33e6a$eb312d70$0200000a@io>

next in thread | raw e-mail | index | archive | help
I recently updated one of my machines to -current to adapt some code to
build under the new version of gcc (3.2.2). However, file IO using <fstream>
gives error messages about implicit typenames being deprecated, and I can't
for the life of me figure out what to do my code to make the compiler happy.
Has anyone encountered this?

Below is a small example illustrating the problem. The source below should
compile fine on a previous version of g++, as in -stable.  However, it will
not compile on -current using g++ 3.3.2. Does anyone know what to do to the
simple source below to get it to compile happily under -current?

(yes, I have checked gnu gcc's mailing list and FAQ/docs. I can't find an
adequate explanation for it. I suspect it has something to do with stricter
conformance to the finalized C++ standard, but since I am still a novice any
explanation by gcc developers would probably have slipped by me)

---------

#include <fstream>

int main()
{
    std::ofstream afile("test.txt");
    afile << "some data";
}

----------

> gcc -v
Using built-in specs.
Configured with: FreeBSD/i386 system compiler
Thread model: posix
gcc version 3.2.2 [FreeBSD] 20030205 (release)

---------

>g++ test.cc
In file included from test.cc:1:
/usr/include/g++/fstream:304: warning: `typename std::basic_filebuf<_CharT,
   _Traits>::int_type' is implicitly a typename
/usr/include/g++/fstream:304: warning: implicit typename is deprecated,
please
   see the documentation for details
/usr/include/g++/fstream:309: warning: `typename std::basic_filebuf<_CharT,
   _Traits>::int_type' is implicitly a typename
/usr/include/g++/fstream:309: warning: implicit typename is deprecated,
please
   see the documentation for details



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?013601c33e6a$eb312d70$0200000a>