This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: C++ PATCH for c++/49673 (constexpr init should go in rodata)
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Jason Merrill <jason at redhat dot com>
- Cc: gcc-patches List <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 8 Jul 2011 16:35:36 +0200
- Subject: Re: C++ PATCH for c++/49673 (constexpr init should go in rodata)
- References: <4E171298.3040203@redhat.com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Fri, Jul 08, 2011 at 10:22:16AM -0400, Jason Merrill wrote:
> --- /dev/null
> +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-rom.C
> @@ -0,0 +1,11 @@
> +// PR c++/49673: check that test_data goes into .rodata
> +// { dg-options -std=c++0x }
> +// { dg-final { scan-assembler "rodata" } }
That will match only on ELF and perhaps a few other targets, but I'm certain
many targets put read-only data elsewhere. I'd just guard this
with a few most common target triplets that are known to use .rodata
section.
> +
> +struct Data
> +{
> + int i;
> + constexpr Data(int i = 0) : i(i+1) {}
> +};
> +
> +extern const Data test_data = { 1 };
Jakub