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]

bug (or nuisance ?) in g++ 2.95.2


Hi,

since recently, g++ insists on having explicit 'int' return types for
functions (because of the ANSI C++ standard). Fine. However, the compilation
breaks also when this syntax is used between extern "C" {}. Illustration:

here is a test file:
-------------
extern "C" {
f();
}

void main()
{}
-------------
wren->gcctest> g++ int.cxx
int.cxx:2: ANSI C++ forbids declaration `f' with no type


I wonder if this is really in the ANSI C++ standard. Indeed, how can one
expect that C header files are suddenly going to be updated ? I'd say that
things within extern "C" {} should follow ANSI C syntax, not C++.


Output of gcc -v
-----------------
wren->gcctest> g++ -v int.cxx
Reading specs from
/usr/local/sol2.7/lib/gcc-lib/sparc-sun-solaris2.7/2.95.2/specs
gcc version 2.95.2 19991024 (release)

/usr/local/sol2.7/lib/gcc-lib/sparc-sun-solaris2.7/2.95.2/cpp -lang-c++ -v -
D__GNUC__=2 -D__GNUG__=2 -D__GNUC_MINOR__=95 -D__cplusplus -Dsparc -Dsun -Du
nix -D__svr4__ -D__SVR4 -D__sparc__ -D__sun__ -D__unix__ -D__svr4__ -D__SVR4
 -D__sparc -D__sun -D__unix -Asystem(unix) -Asystem(svr4) -D__EXCEPTIONS -D_
_GCC_NEW_VARARGS__ -Acpu(sparc) -Amachine(sparc) int.cxx
/var/tmp/ccOyRLRu.ii
GNU CPP version 2.95.2 19991024 (release) (sparc)
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/sol2.7/lib/gcc-lib/sparc-sun-solaris2.7/2.95.2/include/g++

/usr/local/sol2.7/lib/gcc-lib/sparc-sun-solaris2.7/2.95.2/../../../../sparc-
sun-solaris2.7/include
 /usr/local/sol2.7/lib/gcc-lib/sparc-sun-solaris2.7/2.95.2/include
 /usr/include
End of search list.
The following default directories have been omitted from the search path:
 /usr/local/include
End of omitted list.
 /usr/local/sol2.7/lib/gcc-lib/sparc-sun-solaris2.7/2.95.2/cc1plus
/var/tmp/ccOyRLRu.ii -quiet -dumpbase int.cc -version -o /var/tmp/ccW0M7PU.s
GNU C++ version 2.95.2 19991024 (release) (sparc-sun-solaris2.7) compiled by
GNU C version 2.95.2 19991024 (release).
int.cxx:2: ANSI C++ forbids declaration `f' with no type


Output of uname -a
----------------
wren->gcctest> uname -a
SunOS wren 5.7 Generic_106541-07 sun4u sparc SUNW,Ultra-5_10


All the best,

Kris

PS: the same problem occurs in gcc 2.95.1 on NT


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