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