diff options
author | Marek Polacek <polacek@redhat.com> | 2015-03-20 14:56:53 +0000 |
---|---|---|
committer | Marek Polacek <mpolacek@gcc.gnu.org> | 2015-03-20 14:56:53 +0000 |
commit | b75cebc4a74ccc72541875d847bc11889568f127 (patch) | |
tree | 7067e3d329a41be6d9fd852796c6029cb183c8f4 | |
parent | df6d9c7f6af7a59d57caa09bd04265901065bc64 (diff) | |
download | gcc-b75cebc4a74ccc72541875d847bc11889568f127.zip gcc-b75cebc4a74ccc72541875d847bc11889568f127.tar.gz gcc-b75cebc4a74ccc72541875d847bc11889568f127.tar.bz2 |
re PR c++/65072 (Segfault when parsing dectlype in trailing return type)
PR c++/65072
* typeck.c (lookup_anon_field): Make sure we're dealing with the main
variant.
* g++.dg/cpp0x/pr65072.C: New test.
From-SVN: r221535
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/typeck.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/pr65072.C | 14 |
4 files changed, 27 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index f90e447..dadf673 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2015-03-20 Marek Polacek <polacek@redhat.com> + + PR c++/65072 + * typeck.c (lookup_anon_field): Make sure we're dealing with the main + variant. + 2015-03-19 Jason Merrill <jason@redhat.com> PR c++/65046 diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index 4c128b7..e9d4cae 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -2213,6 +2213,8 @@ lookup_anon_field (tree t, tree type) { tree field; + t = TYPE_MAIN_VARIANT (t); + for (field = TYPE_FIELDS (t); field; field = DECL_CHAIN (field)) { if (TREE_STATIC (field)) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 884fb62..c489b28 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-03-20 Marek Polacek <polacek@redhat.com> + + PR c++/65072 + * g++.dg/cpp0x/pr65072.C: New test. + 2015-03-20 Richard Biener <rguenther@suse.de> PR middle-end/64715 diff --git a/gcc/testsuite/g++.dg/cpp0x/pr65072.C b/gcc/testsuite/g++.dg/cpp0x/pr65072.C new file mode 100644 index 0000000..b8fa888 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/pr65072.C @@ -0,0 +1,14 @@ +// PR c++/65075 +// { dg-do compile { target c++11 } } +// { dg-options "-Wno-pedantic" } + +template <typename> class C +{ + struct + { + int i; + }; + auto operator*(const C m) -> decltype (m.i); +}; +void fn1 (const C<float>); +C<float> a; |