diff options
author | Paolo Carlini <paolo.carlini@oracle.com> | 2017-09-12 19:45:37 +0000 |
---|---|---|
committer | Paolo Carlini <paolo@gcc.gnu.org> | 2017-09-12 19:45:37 +0000 |
commit | 741bbaabaffa7db912a775077897ad72611471f3 (patch) | |
tree | ddb77920f0aab7399253ed4730486aa0436fa910 /gcc | |
parent | 18a4e7e305c1e12392ac35073b89f2ca0e7f8eda (diff) | |
download | gcc-741bbaabaffa7db912a775077897ad72611471f3.zip gcc-741bbaabaffa7db912a775077897ad72611471f3.tar.gz gcc-741bbaabaffa7db912a775077897ad72611471f3.tar.bz2 |
re PR c++/70621 (ICE on invalid code at -O1 and above on x86_64-linux-gnu in record_reference, at cgraphbuild.c:64)
/cp
2017-09-12 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/70621
* decl.c (start_decl): Early return error_mark_node if duplicate_decls
returns it; avoid misleading error message.
/testsuite
2017-09-12 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/70621
* g++.dg/torture/pr70621.C: New.
From-SVN: r252040
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/decl.c | 9 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/torture/pr70621.C | 13 |
4 files changed, 29 insertions, 4 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 9e011e9..56ecf72 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2017-09-12 Paolo Carlini <paolo.carlini@oracle.com> + + PR c++/70621 + * decl.c (start_decl): Early return error_mark_node if duplicate_decls + returns it; avoid misleading error message. + 2017-09-12 Nathan Sidwell <nathan@acm.org> Kill CLASSTYPE_SORTED_FIELDS. diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 6f3a348..6101bdf 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -5022,11 +5022,12 @@ start_decl (const cp_declarator *declarator, about this situation, and so we check here. */ if (initialized && DECL_INITIALIZED_IN_CLASS_P (field)) error ("duplicate initialization of %qD", decl); - if (duplicate_decls (decl, field, /*newdecl_is_friend=*/false)) + field = duplicate_decls (decl, field, + /*newdecl_is_friend=*/false); + if (field == error_mark_node) + return error_mark_node; + else if (field) decl = field; - if (decl_spec_seq_has_spec_p (declspecs, ds_constexpr) - && !DECL_DECLARED_CONSTEXPR_P (field)) - error ("%qD declared %<constexpr%> outside its class", field); } } else diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ad989fd..dc5ae01 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +017-09-12 Paolo Carlini <paolo.carlini@oracle.com> + + PR c++/70621 + * g++.dg/torture/pr70621.C: New. + 2017-09-12 Paul Thomas <pault@gcc.gnu.org> PR fortran/82173 diff --git a/gcc/testsuite/g++.dg/torture/pr70621.C b/gcc/testsuite/g++.dg/torture/pr70621.C new file mode 100644 index 0000000..63eb928 --- /dev/null +++ b/gcc/testsuite/g++.dg/torture/pr70621.C @@ -0,0 +1,13 @@ +float foo(); + +struct A +{ + static float x; // { dg-message "previous declaration" } +}; + +double A::x = foo(); // { dg-error "conflicting declaration" } + +void bar() +{ + A::x = 0; +} |