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

Reply via email to