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