NEWS revision 117395
1117395Skan*** Changes in GCC 3.3: 2110611Skan 3117395Skan* The "new X = 3" extension has been removed; you must now use "new X(3)". 4117395Skan 5110611Skan* G++ no longer allows in-class initializations of static data members 6110611Skan that do not have arithmetic or enumeration type. For example: 7110611Skan 8110611Skan struct S { 9110611Skan static const char* const p = "abc"; 10110611Skan }; 11110611Skan 12110611Skan is no longer accepted. 13110611Skan 14110611Skan Use the standards-conformant form: 15110611Skan 16110611Skan struct S { 17110611Skan static const char* const p; 18110611Skan }; 19110611Skan 20110611Skan const char* const S::p = "abc"; 21110611Skan 22110611Skan instead. 23110611Skan 24110611Skan (ISO C++ is even stricter; it does not allow in-class 25110611Skan initializations of floating-point types.) 26110611Skan 2790075Sobrien*** Changes in GCC 3.1: 2890075Sobrien 2990075Sobrien* -fhonor-std and -fno-honor-std have been removed. -fno-honor-std was 3090075Sobrien a workaround to allow std compliant code to work with the non-std 3190075Sobrien compliant libstdc++-v2. libstdc++-v3 is std compliant. 3290075Sobrien 3396263Sobrien* The C++ ABI has been fixed so that `void (A::*)() const' is mangled as 3496263Sobrien "M1AKFvvE", rather than "MK1AFvvE" as before. This change only affects 3596263Sobrien pointer to cv-qualified member function types. 3696263Sobrien 3790075Sobrien* The C++ ABI has been changed to correctly handle this code: 3890075Sobrien 3990075Sobrien struct A { 4090075Sobrien void operator delete[] (void *, size_t); 4190075Sobrien }; 4290075Sobrien 4390075Sobrien struct B : public A { 4490075Sobrien }; 4590075Sobrien 4690075Sobrien new B[10]; 4790075Sobrien 4890075Sobrien The amount of storage allocated for the array will be greater than 4990075Sobrien it was in 3.0, in order to store the number of elements in the 5090075Sobrien array, so that the correct size can be passed to `operator delete[]' 5190075Sobrien when the array is deleted. Previously, the value passed to 5290075Sobrien `operator delete[]' was unpredictable. 5390075Sobrien 5490075Sobrien This change will only affect code that declares a two-argument 5590075Sobrien `operator delete[]' with a second parameter of type `size_t' 5690075Sobrien in a base class, and does not override that definition in a 5790075Sobrien derived class. 5890075Sobrien 5990075Sobrien* The C++ ABI has been changed so that: 6090075Sobrien 6190075Sobrien struct A { 6290075Sobrien void operator delete[] (void *, size_t); 6390075Sobrien void operator delete[] (void *); 6490075Sobrien }; 6590075Sobrien 6690075Sobrien does not cause unnecessary storage to be allocated when an array of 6790075Sobrien `A' objects is allocated. 6890075Sobrien 6990075Sobrien This change will only affect code that declares both of these 7090075Sobrien forms of `operator delete[]', and declared the two-argument form 7190075Sobrien before the one-argument form. 7290075Sobrien 7390075Sobrien* The C++ ABI has been changed so that when a parameter is passed by value, 7490075Sobrien any cleanup for that parameter is performed in the caller, as specified 7596263Sobrien by the ia64 C++ ABI, rather than the called function as before. As a 7696263Sobrien result, classes with a non-trivial destructor but a trivial copy 7796263Sobrien constructor will be passed and returned by invisible reference, rather 7896263Sobrien than by bitwise copy as before. 7990075Sobrien 8096263Sobrien* G++ now supports the "named return value optimization": for code like 8196263Sobrien 8296263Sobrien A f () { 8396263Sobrien A a; 8496263Sobrien ... 8596263Sobrien return a; 8696263Sobrien } 8796263Sobrien 8896263Sobrien G++ will allocate 'a' in the return value slot, so that the return 8996263Sobrien becomes a no-op. For this to work, all return statements in the function 9096263Sobrien must return the same variable. 9196263Sobrien 9290075Sobrien*** Changes in GCC 3.0: 9390075Sobrien 9490075Sobrien* Support for guiding declarations has been removed. 9590075Sobrien 9690075Sobrien* G++ now supports importing member functions from base classes with a 9790075Sobrien using-declaration. 9890075Sobrien 9990075Sobrien* G++ now enforces access control for nested types. 10090075Sobrien 10190075Sobrien* In some obscure cases, functions with the same type could have the 10290075Sobrien same mangled name. This bug caused compiler crashes, link-time clashes, 10390075Sobrien and debugger crashes. Fixing this bug required breaking ABI 10490075Sobrien compatibility for the functions involved. The functions in questions 10590075Sobrien are those whose types involve non-type template arguments whose 10690075Sobrien mangled representations require more than one digit. 10790075Sobrien 10890075Sobrien* Support for assignment to `this' has been removed. This idiom 10990075Sobrien was used in the very early days of C++, before users were allowed 11090075Sobrien to overload `operator new'; it is no longer allowed by the C++ 11190075Sobrien standard. 11290075Sobrien 11390075Sobrien* Support for signatures, a G++ extension, have been removed. 11490075Sobrien 11590075Sobrien* Certain invalid conversions that were previously accepted will now 11690075Sobrien be rejected. For example, assigning function pointers of one type 11790075Sobrien to function pointers of another type now requires a cast, whereas 11890075Sobrien previously g++ would sometimes accept the code even without the 11990075Sobrien cast. 12090075Sobrien 12190075Sobrien* G++ previously allowed `sizeof (X::Y)' where Y was a non-static 12290075Sobrien member of X, even if the `sizeof' expression occurred outside 12390075Sobrien of a non-static member function of X (or one of its derived classes, 12490075Sobrien or a member-initializer for X or one of its derived classes.) This 12590075Sobrien extension has been removed. 12690075Sobrien 12790075Sobrien* G++ no longer allows you to overload the conditional operator (i.e., 12890075Sobrien the `?:' operator.) 12990075Sobrien 13090075Sobrien* The "named return value" extension: 13190075Sobrien 13290075Sobrien int f () return r { r = 3; } 13390075Sobrien 13490075Sobrien has been deprecated, and will be removed in a future version of G++. 13590075Sobrien 13652284Sobrien*** Changes in GCC 2.95: 13752284Sobrien 13852284Sobrien* Messages about non-conformant code that we can still handle ("pedwarns") 13952284Sobrien are now errors by default, rather than warnings. This can be reverted 14052284Sobrien with -fpermissive, and is overridden by -pedantic or -pedantic-errors. 14152284Sobrien 14252284Sobrien* String constants are now of type `const char[n]', rather than `char[n]'. 14352284Sobrien This can be reverted with -fno-const-strings. 14452284Sobrien 14552284Sobrien* References to functions are now supported. 14652284Sobrien 14752284Sobrien* Lookup of class members during class definition now works in all cases. 14852284Sobrien 14952284Sobrien* In overload resolution, type conversion operators are now properly 15052284Sobrien treated as always coming from the most derived class. 15152284Sobrien 15252284Sobrien* C9x-style restricted pointers are supported, using the `__restrict' 15352284Sobrien keyword. 15452284Sobrien 15552284Sobrien* You can now use -fno-implicit-inline-templates to suppress writing out 15652284Sobrien implicit instantiations of inline templates. Normally we do write them 15752284Sobrien out, even with -fno-implicit-templates, so that optimization doesn't 15852284Sobrien affect which instantiations are needed. 15952284Sobrien 16052284Sobrien* -fstrict-prototype now also suppresses implicit declarations. 16152284Sobrien 16252284Sobrien* Many obsolete options have been removed: -fall-virtual, -fmemoize-lookups, 16352284Sobrien -fsave-memoized, +e?, -fenum-int-equivalence, -fno-nonnull-objects. 16452284Sobrien 16552284Sobrien* Unused virtual functions can be discarded on some targets by specifying 16652284Sobrien -ffunction-sections -fvtable-gc to the compiler and --gc-sections to the 16752284Sobrien linker. Unfortunately, this only works on Linux if you're linking 16852284Sobrien statically. 16952284Sobrien 17052284Sobrien* Lots of bugs stomped. 17152284Sobrien 17250397Sobrien*** Changes in EGCS 1.1: 17350397Sobrien 17450397Sobrien* Namespaces are fully supported. The library has not yet been converted 17550397Sobrien to use namespace std, however, and the old std-faking code is still on by 17650397Sobrien default. To turn it off, you can use -fhonor-std. 17750397Sobrien 17850397Sobrien* Massive template improvements: 17950397Sobrien + member template classes are supported. 18050397Sobrien + template friends are supported. 18150397Sobrien + template template parameters are supported. 18250397Sobrien + local classes in templates are supported. 18350397Sobrien + lots of bugs fixed. 18450397Sobrien 18550397Sobrien* operator new now throws bad_alloc where appropriate. 18650397Sobrien 18750397Sobrien* Exception handling is now thread safe, and supports nested exceptions and 18850397Sobrien placement delete. Exception handling overhead on x86 is much lower with 18950397Sobrien GNU as 2.9. 19050397Sobrien 19150397Sobrien* protected virtual inheritance is now supported. 19250397Sobrien 19350397Sobrien* Loops are optimized better; we now move the test to the end in most 19450397Sobrien cases, like the C frontend does. 19550397Sobrien 19650397Sobrien* For class D derived from B which has a member 'int i', &D::i is now of 19750397Sobrien type 'int B::*' instead of 'int D::*'. 19850397Sobrien 19950397Sobrien* An _experimental_ new ABI for g++ can be turned on with -fnew-abi. The 20050397Sobrien current features of this are more efficient allocation of base classes 20150397Sobrien (including the empty base optimization), and more compact mangling of C++ 20250397Sobrien symbol names (which can be turned on separately with -fsquangle). This 20350397Sobrien ABI is subject to change without notice, so don't use it for anything 20450397Sobrien that you don't want to rebuild with every release of the compiler. 20550397Sobrien 20650397Sobrien As with all ABI-changing flags, this flag is for experts only, as all 20750397Sobrien code (including the library code in libgcc and libstdc++) must be 20850397Sobrien compiled with the same ABI. 20950397Sobrien 21050397Sobrien*** Changes in EGCS 1.0: 21150397Sobrien 21250397Sobrien* A public review copy of the December 1996 Draft of the ISO/ANSI C++ 21350397Sobrien standard is now available. See 21450397Sobrien 21550397Sobrien http://www.cygnus.com/misc/wp/ 21650397Sobrien 21750397Sobrien for more information. 21850397Sobrien 21950397Sobrien* g++ now uses a new implementation of templates. The basic idea is that 22050397Sobrien now templates are minimally parsed when seen and then expanded later. 22150397Sobrien This allows conformant early name binding and instantiation controls, 22250397Sobrien since instantiations no longer have to go through the parser. 22350397Sobrien 22450397Sobrien What you get: 22550397Sobrien 22650397Sobrien + Inlining of template functions works without any extra effort or 22750397Sobrien modifications. 22850397Sobrien + Instantiations of class templates and methods defined in the class 22950397Sobrien body are deferred until they are actually needed (unless 23050397Sobrien -fexternal-templates is specified). 23150397Sobrien + Nested types in class templates work. 23250397Sobrien + Static data member templates work. 23350397Sobrien + Member function templates are now supported. 23450397Sobrien + Partial specialization of class templates is now supported. 23550397Sobrien + Explicit specification of template parameters to function templates 23650397Sobrien is now supported. 23750397Sobrien 23850397Sobrien Things you may need to fix in your code: 23950397Sobrien 24050397Sobrien + Syntax errors in templates that are never instantiated will now be 24150397Sobrien diagnosed. 24250397Sobrien + Types and class templates used in templates must be declared 24350397Sobrien first, or the compiler will assume they are not types, and fail. 24450397Sobrien + Similarly, nested types of template type parameters must be tagged 24550397Sobrien with the 'typename' keyword, except in base lists. In many cases, 24650397Sobrien but not all, the compiler will tell you where you need to add 24750397Sobrien 'typename'. For more information, see 24850397Sobrien 24950397Sobrien http://www.cygnus.com/misc/wp/dec96pub/template.html#temp.res 25050397Sobrien 25150397Sobrien + Guiding declarations are no longer supported. Function declarations, 25250397Sobrien including friend declarations, do not refer to template instantiations. 25350397Sobrien You can restore the old behavior with -fguiding-decls until you fix 25450397Sobrien your code. 25550397Sobrien 25650397Sobrien Other features: 25750397Sobrien 25850397Sobrien + Default function arguments in templates will not be evaluated (or 25950397Sobrien checked for semantic validity) unless they are needed. Default 26050397Sobrien arguments in class bodies will not be parsed until the class 26150397Sobrien definition is complete. 26250397Sobrien + The -ftemplate-depth-NN flag can be used to increase the maximum 26350397Sobrien recursive template instantiation depth, which defaults to 17. If you 26450397Sobrien need to use this flag, the compiler will tell you. 26550397Sobrien + Explicit instantiation of template constructors and destructors is 26650397Sobrien now supported. For instance: 26750397Sobrien 26850397Sobrien template A<int>::A(const A&); 26950397Sobrien 27050397Sobrien Still not supported: 27150397Sobrien 27250397Sobrien + Member class templates. 27350397Sobrien + Template friends. 27450397Sobrien 27550397Sobrien* Exception handling support has been significantly improved and is on by 27650397Sobrien default. The compiler supports two mechanisms for walking back up the 27750397Sobrien call stack; one relies on static information about how registers are 27850397Sobrien saved, and causes no runtime overhead for code that does not throw 27950397Sobrien exceptions. The other mechanism uses setjmp and longjmp equivalents, and 28050397Sobrien can result in quite a bit of runtime overhead. You can determine which 28150397Sobrien mechanism is the default for your target by compiling a testcase that 28250397Sobrien uses exceptions and doing an 'nm' on the object file; if it uses __throw, 28350397Sobrien it's using the first mechanism. If it uses __sjthrow, it's using the 28450397Sobrien second. 28550397Sobrien 28650397Sobrien You can turn EH support off with -fno-exceptions. 28750397Sobrien 28850397Sobrien* RTTI support has been rewritten to work properly and is now on by default. 28950397Sobrien This means code that uses virtual functions will have a modest space 29050397Sobrien overhead. You can use the -fno-rtti flag to disable RTTI support. 29150397Sobrien 29250397Sobrien* On ELF systems, duplicate copies of symbols with 'initialized common' 29350397Sobrien linkage (such as template instantiations, vtables, and extern inlines) 29450397Sobrien will now be discarded by the GNU linker, so you don't need to use -frepo. 29550397Sobrien This support requires GNU ld from binutils 2.8 or later. 29650397Sobrien 29750397Sobrien* The overload resolution code has been rewritten to conform to the latest 29850397Sobrien C++ Working Paper. Built-in operators are now considered as candidates 29950397Sobrien in operator overload resolution. Function template overloading chooses 30050397Sobrien the more specialized template, and handles base classes in type deduction 30150397Sobrien and guiding declarations properly. In this release the old code can 30250397Sobrien still be selected with -fno-ansi-overloading, although this is not 30350397Sobrien supported and will be removed in a future release. 30450397Sobrien 30550397Sobrien* Standard usage syntax for the std namespace is supported; std is treated 30650397Sobrien as an alias for global scope. General namespaces are still not supported. 30750397Sobrien 30850397Sobrien* New flags: 30950397Sobrien 31050397Sobrien + New warning -Wno-pmf-conversion (don't warn about 31150397Sobrien converting from a bound member function pointer to function 31250397Sobrien pointer). 31350397Sobrien 31450397Sobrien + A flag -Weffc++ has been added for violations of some of the style 31550397Sobrien guidelines in Scott Meyers' _Effective C++_ books. 31650397Sobrien 31750397Sobrien + -Woverloaded-virtual now warns if a virtual function in a base 31850397Sobrien class is hidden in a derived class, rather than warning about 31950397Sobrien virtual functions being overloaded (even if all of the inherited 32050397Sobrien signatures are overridden) as it did before. 32150397Sobrien 32250397Sobrien + -Wall no longer implies -W. The new warning flag, -Wsign-compare, 32350397Sobrien included in -Wall, warns about dangerous comparisons of signed and 32450397Sobrien unsigned values. Only the flag is new; it was previously part of 32550397Sobrien -W. 32650397Sobrien 32750397Sobrien + The new flag, -fno-weak, disables the use of weak symbols. 32850397Sobrien 32950397Sobrien* Synthesized methods are now emitted in any translation units that need 33050397Sobrien an out-of-line copy. They are no longer affected by #pragma interface 33150397Sobrien or #pragma implementation. 33250397Sobrien 33350397Sobrien* __FUNCTION__ and __PRETTY_FUNCTION__ are now treated as variables by the 33450397Sobrien parser; previously they were treated as string constants. So code like 33550397Sobrien `printf (__FUNCTION__ ": foo")' must be rewritten to 33650397Sobrien `printf ("%s: foo", __FUNCTION__)'. This is necessary for templates. 33750397Sobrien 33850397Sobrien* local static variables in extern inline functions will be shared between 33950397Sobrien translation units. 34050397Sobrien 34150397Sobrien* -fvtable-thunks is supported for all targets, and is the default for 34250397Sobrien Linux with glibc 2.x (also called libc 6.x). 34350397Sobrien 34450397Sobrien* bool is now always the same size as another built-in type. Previously, 34550397Sobrien a 64-bit RISC target using a 32-bit ABI would have 32-bit pointers and a 34650397Sobrien 64-bit bool. This should only affect Irix 6, which was not supported in 34750397Sobrien 2.7.2. 34850397Sobrien 34950397Sobrien* new (nothrow) is now supported. 35050397Sobrien 35150397Sobrien* Synthesized destructors are no longer made virtual just because the class 35250397Sobrien already has virtual functions, only if they override a virtual destructor 35350397Sobrien in a base class. The compiler will warn if this affects your code. 35450397Sobrien 35550397Sobrien* The g++ driver now only links against libstdc++, not libg++; it is 35650397Sobrien functionally identical to the c++ driver. 35750397Sobrien 35850397Sobrien* (void *)0 is no longer considered a null pointer constant; NULL in 35950397Sobrien <stddef.h> is now defined as __null, a magic constant of type (void *) 36050397Sobrien normally, or (size_t) with -ansi. 36150397Sobrien 36250397Sobrien* The name of a class is now implicitly declared in its own scope; A::A 36350397Sobrien refers to A. 36450397Sobrien 36550397Sobrien* Local classes are now supported. 36650397Sobrien 36750397Sobrien* __attribute__ can now be attached to types as well as declarations. 36850397Sobrien 36950397Sobrien* The compiler no longer emits a warning if an ellipsis is used as a 37050397Sobrien function's argument list. 37150397Sobrien 37250397Sobrien* Definition of nested types outside of their containing class is now 37350397Sobrien supported. For instance: 37450397Sobrien 37550397Sobrien struct A { 37650397Sobrien struct B; 37750397Sobrien B* bp; 37850397Sobrien }; 37950397Sobrien 38050397Sobrien struct A::B { 38150397Sobrien int member; 38250397Sobrien }; 38350397Sobrien 38450397Sobrien* On the HPPA, some classes that do not define a copy constructor 38550397Sobrien will be passed and returned in memory again so that functions 38650397Sobrien returning those types can be inlined. 38750397Sobrien 38850397Sobrien*** The g++ team thanks everyone that contributed to this release, 38950397Sobrien but especially: 39050397Sobrien 39150397Sobrien* Joe Buck <jbuck@synopsys.com>, the maintainer of the g++ FAQ. 39250397Sobrien* Brendan Kehoe <brendan@cygnus.com>, who coordinates testing of g++. 39350397Sobrien* Jason Merrill <jason@cygnus.com>, the g++ maintainer. 39450397Sobrien* Mark Mitchell <mmitchell@usa.net>, who implemented member function 39550397Sobrien templates and explicit qualification of function templates. 39650397Sobrien* Mike Stump <mrs@wrs.com>, the previous g++ maintainer, who did most of 39750397Sobrien the exception handling work. 398