NEWS revision 96263
190075Sobrien*** Changes in GCC 3.1: 290075Sobrien 390075Sobrien* -fhonor-std and -fno-honor-std have been removed. -fno-honor-std was 490075Sobrien a workaround to allow std compliant code to work with the non-std 590075Sobrien compliant libstdc++-v2. libstdc++-v3 is std compliant. 690075Sobrien 796263Sobrien* The C++ ABI has been fixed so that `void (A::*)() const' is mangled as 896263Sobrien "M1AKFvvE", rather than "MK1AFvvE" as before. This change only affects 996263Sobrien pointer to cv-qualified member function types. 1096263Sobrien 1190075Sobrien* The C++ ABI has been changed to correctly handle this code: 1290075Sobrien 1390075Sobrien struct A { 1490075Sobrien void operator delete[] (void *, size_t); 1590075Sobrien }; 1690075Sobrien 1790075Sobrien struct B : public A { 1890075Sobrien }; 1990075Sobrien 2090075Sobrien new B[10]; 2190075Sobrien 2290075Sobrien The amount of storage allocated for the array will be greater than 2390075Sobrien it was in 3.0, in order to store the number of elements in the 2490075Sobrien array, so that the correct size can be passed to `operator delete[]' 2590075Sobrien when the array is deleted. Previously, the value passed to 2690075Sobrien `operator delete[]' was unpredictable. 2790075Sobrien 2890075Sobrien This change will only affect code that declares a two-argument 2990075Sobrien `operator delete[]' with a second parameter of type `size_t' 3090075Sobrien in a base class, and does not override that definition in a 3190075Sobrien derived class. 3290075Sobrien 3390075Sobrien* The C++ ABI has been changed so that: 3490075Sobrien 3590075Sobrien struct A { 3690075Sobrien void operator delete[] (void *, size_t); 3790075Sobrien void operator delete[] (void *); 3890075Sobrien }; 3990075Sobrien 4090075Sobrien does not cause unnecessary storage to be allocated when an array of 4190075Sobrien `A' objects is allocated. 4290075Sobrien 4390075Sobrien This change will only affect code that declares both of these 4490075Sobrien forms of `operator delete[]', and declared the two-argument form 4590075Sobrien before the one-argument form. 4690075Sobrien 4790075Sobrien* The C++ ABI has been changed so that when a parameter is passed by value, 4890075Sobrien any cleanup for that parameter is performed in the caller, as specified 4996263Sobrien by the ia64 C++ ABI, rather than the called function as before. As a 5096263Sobrien result, classes with a non-trivial destructor but a trivial copy 5196263Sobrien constructor will be passed and returned by invisible reference, rather 5296263Sobrien than by bitwise copy as before. 5390075Sobrien 5496263Sobrien* G++ now supports the "named return value optimization": for code like 5596263Sobrien 5696263Sobrien A f () { 5796263Sobrien A a; 5896263Sobrien ... 5996263Sobrien return a; 6096263Sobrien } 6196263Sobrien 6296263Sobrien G++ will allocate 'a' in the return value slot, so that the return 6396263Sobrien becomes a no-op. For this to work, all return statements in the function 6496263Sobrien must return the same variable. 6596263Sobrien 6690075Sobrien*** Changes in GCC 3.0: 6790075Sobrien 6890075Sobrien* Support for guiding declarations has been removed. 6990075Sobrien 7090075Sobrien* G++ now supports importing member functions from base classes with a 7190075Sobrien using-declaration. 7290075Sobrien 7390075Sobrien* G++ now enforces access control for nested types. 7490075Sobrien 7590075Sobrien* In some obscure cases, functions with the same type could have the 7690075Sobrien same mangled name. This bug caused compiler crashes, link-time clashes, 7790075Sobrien and debugger crashes. Fixing this bug required breaking ABI 7890075Sobrien compatibility for the functions involved. The functions in questions 7990075Sobrien are those whose types involve non-type template arguments whose 8090075Sobrien mangled representations require more than one digit. 8190075Sobrien 8290075Sobrien* Support for assignment to `this' has been removed. This idiom 8390075Sobrien was used in the very early days of C++, before users were allowed 8490075Sobrien to overload `operator new'; it is no longer allowed by the C++ 8590075Sobrien standard. 8690075Sobrien 8790075Sobrien* Support for signatures, a G++ extension, have been removed. 8890075Sobrien 8990075Sobrien* Certain invalid conversions that were previously accepted will now 9090075Sobrien be rejected. For example, assigning function pointers of one type 9190075Sobrien to function pointers of another type now requires a cast, whereas 9290075Sobrien previously g++ would sometimes accept the code even without the 9390075Sobrien cast. 9490075Sobrien 9590075Sobrien* G++ previously allowed `sizeof (X::Y)' where Y was a non-static 9690075Sobrien member of X, even if the `sizeof' expression occurred outside 9790075Sobrien of a non-static member function of X (or one of its derived classes, 9890075Sobrien or a member-initializer for X or one of its derived classes.) This 9990075Sobrien extension has been removed. 10090075Sobrien 10190075Sobrien* G++ no longer allows you to overload the conditional operator (i.e., 10290075Sobrien the `?:' operator.) 10390075Sobrien 10490075Sobrien* The "named return value" extension: 10590075Sobrien 10690075Sobrien int f () return r { r = 3; } 10790075Sobrien 10890075Sobrien has been deprecated, and will be removed in a future version of G++. 10990075Sobrien 11052284Sobrien*** Changes in GCC 2.95: 11152284Sobrien 11252284Sobrien* Messages about non-conformant code that we can still handle ("pedwarns") 11352284Sobrien are now errors by default, rather than warnings. This can be reverted 11452284Sobrien with -fpermissive, and is overridden by -pedantic or -pedantic-errors. 11552284Sobrien 11652284Sobrien* String constants are now of type `const char[n]', rather than `char[n]'. 11752284Sobrien This can be reverted with -fno-const-strings. 11852284Sobrien 11952284Sobrien* References to functions are now supported. 12052284Sobrien 12152284Sobrien* Lookup of class members during class definition now works in all cases. 12252284Sobrien 12352284Sobrien* In overload resolution, type conversion operators are now properly 12452284Sobrien treated as always coming from the most derived class. 12552284Sobrien 12652284Sobrien* C9x-style restricted pointers are supported, using the `__restrict' 12752284Sobrien keyword. 12852284Sobrien 12952284Sobrien* You can now use -fno-implicit-inline-templates to suppress writing out 13052284Sobrien implicit instantiations of inline templates. Normally we do write them 13152284Sobrien out, even with -fno-implicit-templates, so that optimization doesn't 13252284Sobrien affect which instantiations are needed. 13352284Sobrien 13452284Sobrien* -fstrict-prototype now also suppresses implicit declarations. 13552284Sobrien 13652284Sobrien* Many obsolete options have been removed: -fall-virtual, -fmemoize-lookups, 13752284Sobrien -fsave-memoized, +e?, -fenum-int-equivalence, -fno-nonnull-objects. 13852284Sobrien 13952284Sobrien* Unused virtual functions can be discarded on some targets by specifying 14052284Sobrien -ffunction-sections -fvtable-gc to the compiler and --gc-sections to the 14152284Sobrien linker. Unfortunately, this only works on Linux if you're linking 14252284Sobrien statically. 14352284Sobrien 14452284Sobrien* Lots of bugs stomped. 14552284Sobrien 14650397Sobrien*** Changes in EGCS 1.1: 14750397Sobrien 14850397Sobrien* Namespaces are fully supported. The library has not yet been converted 14950397Sobrien to use namespace std, however, and the old std-faking code is still on by 15050397Sobrien default. To turn it off, you can use -fhonor-std. 15150397Sobrien 15250397Sobrien* Massive template improvements: 15350397Sobrien + member template classes are supported. 15450397Sobrien + template friends are supported. 15550397Sobrien + template template parameters are supported. 15650397Sobrien + local classes in templates are supported. 15750397Sobrien + lots of bugs fixed. 15850397Sobrien 15950397Sobrien* operator new now throws bad_alloc where appropriate. 16050397Sobrien 16150397Sobrien* Exception handling is now thread safe, and supports nested exceptions and 16250397Sobrien placement delete. Exception handling overhead on x86 is much lower with 16350397Sobrien GNU as 2.9. 16450397Sobrien 16550397Sobrien* protected virtual inheritance is now supported. 16650397Sobrien 16750397Sobrien* Loops are optimized better; we now move the test to the end in most 16850397Sobrien cases, like the C frontend does. 16950397Sobrien 17050397Sobrien* For class D derived from B which has a member 'int i', &D::i is now of 17150397Sobrien type 'int B::*' instead of 'int D::*'. 17250397Sobrien 17350397Sobrien* An _experimental_ new ABI for g++ can be turned on with -fnew-abi. The 17450397Sobrien current features of this are more efficient allocation of base classes 17550397Sobrien (including the empty base optimization), and more compact mangling of C++ 17650397Sobrien symbol names (which can be turned on separately with -fsquangle). This 17750397Sobrien ABI is subject to change without notice, so don't use it for anything 17850397Sobrien that you don't want to rebuild with every release of the compiler. 17950397Sobrien 18050397Sobrien As with all ABI-changing flags, this flag is for experts only, as all 18150397Sobrien code (including the library code in libgcc and libstdc++) must be 18250397Sobrien compiled with the same ABI. 18350397Sobrien 18450397Sobrien*** Changes in EGCS 1.0: 18550397Sobrien 18650397Sobrien* A public review copy of the December 1996 Draft of the ISO/ANSI C++ 18750397Sobrien standard is now available. See 18850397Sobrien 18950397Sobrien http://www.cygnus.com/misc/wp/ 19050397Sobrien 19150397Sobrien for more information. 19250397Sobrien 19350397Sobrien* g++ now uses a new implementation of templates. The basic idea is that 19450397Sobrien now templates are minimally parsed when seen and then expanded later. 19550397Sobrien This allows conformant early name binding and instantiation controls, 19650397Sobrien since instantiations no longer have to go through the parser. 19750397Sobrien 19850397Sobrien What you get: 19950397Sobrien 20050397Sobrien + Inlining of template functions works without any extra effort or 20150397Sobrien modifications. 20250397Sobrien + Instantiations of class templates and methods defined in the class 20350397Sobrien body are deferred until they are actually needed (unless 20450397Sobrien -fexternal-templates is specified). 20550397Sobrien + Nested types in class templates work. 20650397Sobrien + Static data member templates work. 20750397Sobrien + Member function templates are now supported. 20850397Sobrien + Partial specialization of class templates is now supported. 20950397Sobrien + Explicit specification of template parameters to function templates 21050397Sobrien is now supported. 21150397Sobrien 21250397Sobrien Things you may need to fix in your code: 21350397Sobrien 21450397Sobrien + Syntax errors in templates that are never instantiated will now be 21550397Sobrien diagnosed. 21650397Sobrien + Types and class templates used in templates must be declared 21750397Sobrien first, or the compiler will assume they are not types, and fail. 21850397Sobrien + Similarly, nested types of template type parameters must be tagged 21950397Sobrien with the 'typename' keyword, except in base lists. In many cases, 22050397Sobrien but not all, the compiler will tell you where you need to add 22150397Sobrien 'typename'. For more information, see 22250397Sobrien 22350397Sobrien http://www.cygnus.com/misc/wp/dec96pub/template.html#temp.res 22450397Sobrien 22550397Sobrien + Guiding declarations are no longer supported. Function declarations, 22650397Sobrien including friend declarations, do not refer to template instantiations. 22750397Sobrien You can restore the old behavior with -fguiding-decls until you fix 22850397Sobrien your code. 22950397Sobrien 23050397Sobrien Other features: 23150397Sobrien 23250397Sobrien + Default function arguments in templates will not be evaluated (or 23350397Sobrien checked for semantic validity) unless they are needed. Default 23450397Sobrien arguments in class bodies will not be parsed until the class 23550397Sobrien definition is complete. 23650397Sobrien + The -ftemplate-depth-NN flag can be used to increase the maximum 23750397Sobrien recursive template instantiation depth, which defaults to 17. If you 23850397Sobrien need to use this flag, the compiler will tell you. 23950397Sobrien + Explicit instantiation of template constructors and destructors is 24050397Sobrien now supported. For instance: 24150397Sobrien 24250397Sobrien template A<int>::A(const A&); 24350397Sobrien 24450397Sobrien Still not supported: 24550397Sobrien 24650397Sobrien + Member class templates. 24750397Sobrien + Template friends. 24850397Sobrien 24950397Sobrien* Exception handling support has been significantly improved and is on by 25050397Sobrien default. The compiler supports two mechanisms for walking back up the 25150397Sobrien call stack; one relies on static information about how registers are 25250397Sobrien saved, and causes no runtime overhead for code that does not throw 25350397Sobrien exceptions. The other mechanism uses setjmp and longjmp equivalents, and 25450397Sobrien can result in quite a bit of runtime overhead. You can determine which 25550397Sobrien mechanism is the default for your target by compiling a testcase that 25650397Sobrien uses exceptions and doing an 'nm' on the object file; if it uses __throw, 25750397Sobrien it's using the first mechanism. If it uses __sjthrow, it's using the 25850397Sobrien second. 25950397Sobrien 26050397Sobrien You can turn EH support off with -fno-exceptions. 26150397Sobrien 26250397Sobrien* RTTI support has been rewritten to work properly and is now on by default. 26350397Sobrien This means code that uses virtual functions will have a modest space 26450397Sobrien overhead. You can use the -fno-rtti flag to disable RTTI support. 26550397Sobrien 26650397Sobrien* On ELF systems, duplicate copies of symbols with 'initialized common' 26750397Sobrien linkage (such as template instantiations, vtables, and extern inlines) 26850397Sobrien will now be discarded by the GNU linker, so you don't need to use -frepo. 26950397Sobrien This support requires GNU ld from binutils 2.8 or later. 27050397Sobrien 27150397Sobrien* The overload resolution code has been rewritten to conform to the latest 27250397Sobrien C++ Working Paper. Built-in operators are now considered as candidates 27350397Sobrien in operator overload resolution. Function template overloading chooses 27450397Sobrien the more specialized template, and handles base classes in type deduction 27550397Sobrien and guiding declarations properly. In this release the old code can 27650397Sobrien still be selected with -fno-ansi-overloading, although this is not 27750397Sobrien supported and will be removed in a future release. 27850397Sobrien 27950397Sobrien* Standard usage syntax for the std namespace is supported; std is treated 28050397Sobrien as an alias for global scope. General namespaces are still not supported. 28150397Sobrien 28250397Sobrien* New flags: 28350397Sobrien 28450397Sobrien + New warning -Wno-pmf-conversion (don't warn about 28550397Sobrien converting from a bound member function pointer to function 28650397Sobrien pointer). 28750397Sobrien 28850397Sobrien + A flag -Weffc++ has been added for violations of some of the style 28950397Sobrien guidelines in Scott Meyers' _Effective C++_ books. 29050397Sobrien 29150397Sobrien + -Woverloaded-virtual now warns if a virtual function in a base 29250397Sobrien class is hidden in a derived class, rather than warning about 29350397Sobrien virtual functions being overloaded (even if all of the inherited 29450397Sobrien signatures are overridden) as it did before. 29550397Sobrien 29650397Sobrien + -Wall no longer implies -W. The new warning flag, -Wsign-compare, 29750397Sobrien included in -Wall, warns about dangerous comparisons of signed and 29850397Sobrien unsigned values. Only the flag is new; it was previously part of 29950397Sobrien -W. 30050397Sobrien 30150397Sobrien + The new flag, -fno-weak, disables the use of weak symbols. 30250397Sobrien 30350397Sobrien* Synthesized methods are now emitted in any translation units that need 30450397Sobrien an out-of-line copy. They are no longer affected by #pragma interface 30550397Sobrien or #pragma implementation. 30650397Sobrien 30750397Sobrien* __FUNCTION__ and __PRETTY_FUNCTION__ are now treated as variables by the 30850397Sobrien parser; previously they were treated as string constants. So code like 30950397Sobrien `printf (__FUNCTION__ ": foo")' must be rewritten to 31050397Sobrien `printf ("%s: foo", __FUNCTION__)'. This is necessary for templates. 31150397Sobrien 31250397Sobrien* local static variables in extern inline functions will be shared between 31350397Sobrien translation units. 31450397Sobrien 31550397Sobrien* -fvtable-thunks is supported for all targets, and is the default for 31650397Sobrien Linux with glibc 2.x (also called libc 6.x). 31750397Sobrien 31850397Sobrien* bool is now always the same size as another built-in type. Previously, 31950397Sobrien a 64-bit RISC target using a 32-bit ABI would have 32-bit pointers and a 32050397Sobrien 64-bit bool. This should only affect Irix 6, which was not supported in 32150397Sobrien 2.7.2. 32250397Sobrien 32350397Sobrien* new (nothrow) is now supported. 32450397Sobrien 32550397Sobrien* Synthesized destructors are no longer made virtual just because the class 32650397Sobrien already has virtual functions, only if they override a virtual destructor 32750397Sobrien in a base class. The compiler will warn if this affects your code. 32850397Sobrien 32950397Sobrien* The g++ driver now only links against libstdc++, not libg++; it is 33050397Sobrien functionally identical to the c++ driver. 33150397Sobrien 33250397Sobrien* (void *)0 is no longer considered a null pointer constant; NULL in 33350397Sobrien <stddef.h> is now defined as __null, a magic constant of type (void *) 33450397Sobrien normally, or (size_t) with -ansi. 33550397Sobrien 33650397Sobrien* The name of a class is now implicitly declared in its own scope; A::A 33750397Sobrien refers to A. 33850397Sobrien 33950397Sobrien* Local classes are now supported. 34050397Sobrien 34150397Sobrien* __attribute__ can now be attached to types as well as declarations. 34250397Sobrien 34350397Sobrien* The compiler no longer emits a warning if an ellipsis is used as a 34450397Sobrien function's argument list. 34550397Sobrien 34650397Sobrien* Definition of nested types outside of their containing class is now 34750397Sobrien supported. For instance: 34850397Sobrien 34950397Sobrien struct A { 35050397Sobrien struct B; 35150397Sobrien B* bp; 35250397Sobrien }; 35350397Sobrien 35450397Sobrien struct A::B { 35550397Sobrien int member; 35650397Sobrien }; 35750397Sobrien 35850397Sobrien* On the HPPA, some classes that do not define a copy constructor 35950397Sobrien will be passed and returned in memory again so that functions 36050397Sobrien returning those types can be inlined. 36150397Sobrien 36250397Sobrien*** The g++ team thanks everyone that contributed to this release, 36350397Sobrien but especially: 36450397Sobrien 36550397Sobrien* Joe Buck <jbuck@synopsys.com>, the maintainer of the g++ FAQ. 36650397Sobrien* Brendan Kehoe <brendan@cygnus.com>, who coordinates testing of g++. 36750397Sobrien* Jason Merrill <jason@cygnus.com>, the g++ maintainer. 36850397Sobrien* Mark Mitchell <mmitchell@usa.net>, who implemented member function 36950397Sobrien templates and explicit qualification of function templates. 37050397Sobrien* Mike Stump <mrs@wrs.com>, the previous g++ maintainer, who did most of 37150397Sobrien the exception handling work. 372