From patchwork Thu Feb 11 14:20:00 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Polacek X-Patchwork-Id: 581904 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 5C91414031B for ; Fri, 12 Feb 2016 01:20:15 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=Ad5Pgb89; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:mime-version:content-type; q=dns; s=default; b=bkDuUCpDBOiFiDyzu+Y9vVU+0Lehiy74A9GyQiwuSOZAtpRgsd GV830urWWiRtDPpcKHI7+lRy/49ucNd62/vUDnaxt0ldoBdgrRDo2BC6GnSkMY7M /YWNxiUgRrqo8BOB4bNTgNW14DQpWsUwUPiS4NpqYe5X0I03fRKwMdEfs= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:mime-version:content-type; s= default; bh=lZAGveJVNyTfQbO/x5amTjSgark=; b=Ad5Pgb89JJiG4slrDWzu AxaRyvmhS2ARQLmHQefEg2gLAaqXHNaj76jHYDP2NnqJ+PPiqpCqWawFJsWxR9Hi 3tSQZxgejBj0E2HVnR4mrBpMJmShs8McUwQ60pLV8MyYnVMpP/rofg0ht3bmitNf V2Qj5P+7YWf6GpB/pBmEThw= Received: (qmail 119203 invoked by alias); 11 Feb 2016 14:20:08 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 119193 invoked by uid 89); 11 Feb 2016 14:20:07 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=2696, 1.9 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Thu, 11 Feb 2016 14:20:06 +0000 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (Postfix) with ESMTPS id E1A0813595 for ; Thu, 11 Feb 2016 14:20:04 +0000 (UTC) Received: from redhat.com (ovpn-204-16.brq.redhat.com [10.40.204.16]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u1BEK08Z015535 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 11 Feb 2016 09:20:03 -0500 Date: Thu, 11 Feb 2016 15:20:00 +0100 From: Marek Polacek To: GCC Patches Cc: Jonathan Wakely Subject: [wwwdocs] Add a note about in-class initialization of static data member Message-ID: <20160211142000.GB3163@redhat.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) Does this look ok? Marek Index: porting_to.html =================================================================== RCS file: /cvs/gcc/wwwdocs/htdocs/gcc-6/porting_to.html,v retrieving revision 1.9 diff -u -r1.9 porting_to.html --- porting_to.html 10 Feb 2016 17:21:54 -0000 1.9 +++ porting_to.html 11 Feb 2016 14:18:59 -0000 @@ -269,6 +269,25 @@ to port the code to use C++11's std::unique_ptr instead.

+

'constexpr' needed for in-class initialization of static data member

+ +

+Since C++11, the constexpr keyword is needed when initializing +a non-integral static data member in a class. Thus the following program is +accepted in C++03 (albeit with a -Wpedantic warning): +

+ +

+struct X {
+  const static double i = 10;
+};
+
+ +

+While in C++11, the program above is rejected with an error. The fix is to +use constexpr instead of const. +

+

-Wmisleading-indentation

A new warning -Wmisleading-indentation was added