From patchwork Thu Sep 15 12:34:24 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kratochvil X-Patchwork-Id: 15667 Received: (qmail 78208 invoked by alias); 15 Sep 2016 12:34:41 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 78161 invoked by uid 89); 15 Sep 2016 12:34:40 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.1 required=5.0 tests=BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=stayed, Hx-languages-length:1883, 69 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 ESMTP; Thu, 15 Sep 2016 12:34:30 +0000 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E176F3138 for ; Thu, 15 Sep 2016 12:34:28 +0000 (UTC) Received: from host1.jankratochvil.net (ovpn-116-52.ams2.redhat.com [10.36.116.52]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u8FCYPjl031321 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 15 Sep 2016 08:34:28 -0400 Date: Thu, 15 Sep 2016 14:34:24 +0200 From: Jan Kratochvil To: Pedro Alves Cc: gdb-patches@sourceware.org Subject: Re: [testsuite patch] Fix C++11 compilation failure for gdb.cp/m-static.exp Message-ID: <20160915123424.GA8875@host1.jankratochvil.net> References: <20160911142248.GA12817@host1.jankratochvil.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.7.0 (2016-08-17) X-IsSubscribed: yes On Thu, 15 Sep 2016 14:22:54 +0200, Pedro Alves wrote: > Did you try moving the initialization to the .cc file? Like: > > const float gnu_obj_4::somewhere = 3.14159; > > Did you find a reason to not do that? I have found that it may invalidate the testcase some way so I stayed on the safe side. I have read now briefly the .exp file and it does have some XFAIL around "extra CU-level DW_TAG_variable as DW_AT_declaration". But those compiler bugs should be forgotten now so I am fine even with this new patch below. Jan gdb/testsuite/ChangeLog 2016-09-15 Jan Kratochvil * gdb.cp/m-static.cc (gnu_obj_4::somewhere): New. * gdb.cp/m-static.h (class gnu_obj_4): Remove somewhere initializer. diff --git a/gdb/testsuite/gdb.cp/m-static.cc b/gdb/testsuite/gdb.cp/m-static.cc index cb871e8..e5e2d62 100644 --- a/gdb/testsuite/gdb.cp/m-static.cc +++ b/gdb/testsuite/gdb.cp/m-static.cc @@ -77,6 +77,7 @@ gnu_obj_2 gnu_obj_3::data(etruscan); // 2002-08-16 // Test four. #include "m-static.h" +const float gnu_obj_4::somewhere = 3.14159; // instantiate templates explicitly so their static members will exist template class gnu_obj_2; diff --git a/gdb/testsuite/gdb.cp/m-static.h b/gdb/testsuite/gdb.cp/m-static.h index bcedfff..083e1e2 100644 --- a/gdb/testsuite/gdb.cp/m-static.h +++ b/gdb/testsuite/gdb.cp/m-static.h @@ -6,9 +6,10 @@ class gnu_obj_4 static const int elsewhere; static const int nowhere; static const int everywhere = 317; - static const float somewhere = 3.14159; + // see m-static.cc - otherwise: + // error: 'constexpr' needed for in-class initialization of static data member 'const float gnu_obj_4::somewhere' of non-integral type [-fpermissive] + static const float somewhere; // try to ensure test4 is actually allocated int dummy; }; -