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