Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: Pedro Alves <palves@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [testsuite patch] Fix C++11 compilation failure for gdb.cp/m-static.exp
Date: Thu, 15 Sep 2016 12:34:00 -0000	[thread overview]
Message-ID: <20160915123424.GA8875@host1.jankratochvil.net> (raw)
In-Reply-To: <ad9bde03-2d84-402a-5dd2-daaed5d05427@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 529 bytes --]

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

[-- Attachment #2: 1 --]
[-- Type: text/plain, Size: 1309 bytes --]

gdb/testsuite/ChangeLog
2016-09-15  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* 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<int> gnu_obj_3<T>::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<int>;
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;
 };
-

  reply	other threads:[~2016-09-15 12:34 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-11 14:22 Jan Kratochvil
2016-09-15 12:22 ` Pedro Alves
2016-09-15 12:34   ` Jan Kratochvil [this message]
2016-09-15 13:11     ` Pedro Alves
2016-09-15 21:47       ` [commit] " Jan Kratochvil

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160915123424.GA8875@host1.jankratochvil.net \
    --to=jan.kratochvil@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=palves@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox