diff options
author | Jason Merrill <jason@redhat.com> | 2011-03-16 22:36:20 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2011-03-16 22:36:20 -0400 |
commit | 89ae3825aa6e60bb68010353f2a292a056b8a9da (patch) | |
tree | 8ccb50efec49febe52d977ead34f18d1439c2134 /gcc | |
parent | 9f2a22d0b89e8e4208e84aaeab23f563c085c6c8 (diff) | |
download | gcc-89ae3825aa6e60bb68010353f2a292a056b8a9da.zip gcc-89ae3825aa6e60bb68010353f2a292a056b8a9da.tar.gz gcc-89ae3825aa6e60bb68010353f2a292a056b8a9da.tar.bz2 |
re PR c++/47301 ([C++0x] ICE: in fold_convert_loc, at fold-const.c:1906 with -fabi-version=1 and constexpr)
PR c++/47301
* decl.c (compute_array_index_type): Don't bother trying to deal
with literal classes in ABI v1.
From-SVN: r171085
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/cp/decl.c | 8 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 2 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/constexpr-abi1.C | 16 |
4 files changed, 28 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 66c8316..d96b4b3 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2011-03-16 Jason Merrill <jason@redhat.com> + PR c++/47301 + * decl.c (compute_array_index_type): Don't bother trying to deal + with literal classes in ABI v1. + PR c++/46336 * decl.c (duplicate_decls): Return NULL_TREE for clashing C functions. diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 17b3163..a7da574 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -7525,6 +7525,9 @@ compute_array_index_type (tree name, tree size, tsubst_flags_t complain) if (size == error_mark_node) return error_mark_node; type = TREE_TYPE (size); + /* We didn't support this case in GCC 3.2, so don't bother + trying to model it now in ABI v1. */ + abi_1_itype = error_mark_node; } size = maybe_constant_value (size); @@ -7569,7 +7572,8 @@ compute_array_index_type (tree name, tree size, tsubst_flags_t complain) return itype; } - if (!abi_version_at_least (2) && processing_template_decl) + if (!abi_version_at_least (2) && processing_template_decl + && abi_1_itype == NULL_TREE) /* For abi-1, we handled all instances in templates the same way, even when they were non-dependent. This affects the manglings produced. So, we do the normal checking for non-dependent @@ -7683,7 +7687,7 @@ compute_array_index_type (tree name, tree size, tsubst_flags_t complain) } /* Create and return the appropriate index type. */ - if (abi_1_itype) + if (abi_1_itype && abi_1_itype != error_mark_node) { tree t = build_index_type (itype); TYPE_CANONICAL (abi_1_itype) = TYPE_CANONICAL (t); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 122beef..bf17d3d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,7 @@ 2011-03-16 Jason Merrill <jason@redhat.com> + * g++.dg/cpp0x/constexpr-abi1.C: New. + * g++.dg/cpp0x/constexpr-46336.C: New. * g++.dg/parse/friend5.C: Adjust expected errors. diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-abi1.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-abi1.C new file mode 100644 index 0000000..e83f142 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-abi1.C @@ -0,0 +1,16 @@ +// PR c++/47301 +// { dg-options "-std=c++0x -fabi-version=1" } + +struct A +{ + constexpr operator int () + { + return 1; + } +}; + +template < int > struct B +{ + static constexpr A a = A(); + int ar[a]; +}; |