Document deprecated g++ extensions [was Re: C++ PATCH: Disallow floating-point literals in integral-constant expressions]

Jonathan Wakely cow@compsoc.man.ac.uk
Mon Feb 7 18:39:00 GMT 2005


On Thu, Feb 03, 2005 at 10:51:09PM -0800, Mark Mitchell wrote:

> Jonathan Wakely wrote:
> >On Tue, Feb 01, 2005 at 11:55:58AM -0800, Mark Mitchell wrote:
> >Is this OK?  Have I correctly described the extensions?  
> 
> Thank you for taking a stab at the documentation.

Not a very good stab, but I'll get there in the end  :-)

Thanks for the help getting it right.

> Not quite.  There are two completely orthogonal extensions: (1) we allow 
> floating-point literals in integral constant expressions, and (2) we 
> allow in-class initialization of static data members of floating-point type.
> 
> An example of (1) without (2) is something like:
> 
>   enum E { e = int(2.2 + 3.7) };
> 
> which is invalid ISO C++, but is accepted by G++, without -pedantic.

Of course - doesn't have to be in an initializer. Duh.

> >Should I try to
> >fix the alignment of the menu at the top of the file?
> 
> Joseph Myers is probably the right person to ask about that.

Then I might do that separately some other time.

> I think that you should also move these descriptions under "Deprecated 
> Features", as nobody objected to deprecating this extension.

That makes the patch much smaller. New version attached.

jon


-- 
No sig today
-------------- next part --------------
Index: gcc/ChangeLog
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ChangeLog,v
retrieving revision 2.7408
diff -u -p -b -B -r2.7408 ChangeLog
--- gcc/ChangeLog	7 Feb 2005 10:06:35 -0000	2.7408
+++ gcc/ChangeLog	7 Feb 2005 14:39:48 -0000
@@ -1,3 +1,9 @@
+2005-02-07  Jonathan Wakely  <redi@gcc.gnu.org>
+
+	* doc/extend.texi: Document deprecated extensions allowing
+	static floating-point members to have initializers and allowing
+	floating-point literals in integral constant expressions.
+
 2005-02-07  Leehod Baruch  <leehod@il.ibm.com>
 	    Dorit Naishlos  <dorit@il.ibm.com>
 
Index: gcc/doc/extend.texi
===================================================================
RCS file: /cvs/gcc/gcc/gcc/doc/extend.texi,v
retrieving revision 1.237
diff -u -p -b -B -r1.237 extend.texi
--- gcc/doc/extend.texi	1 Feb 2005 22:45:22 -0000	1.237
+++ gcc/doc/extend.texi	7 Feb 2005 14:39:51 -0000
@@ -9799,6 +9799,15 @@ The use of default arguments in function
 and other places where they are not permitted by the standard is
 deprecated and will be removed from a future version of G++.
 
+G++ allows floating-point literals to appear in integral constant expressions,
+e.g. @samp{ enum E @{ e = int(2.2 * 3.7) @} }
+This extension is deprecated and will be removed from a future version.
+
+G++ allows static data members of const floating-point type to be declared
+with an initializer. The standard only allows initializers for static
+members of const integral types and const enumeration types so this
+extension has been deprecated and will be removed from a future version.
+
 @node Backwards Compatibility
 @section Backwards Compatibility
 @cindex Backwards Compatibility


More information about the Gcc-patches mailing list