diff options
author | Paolo Carlini <paolo.carlini@oracle.com> | 2017-03-21 10:18:51 +0000 |
---|---|---|
committer | Paolo Carlini <paolo@gcc.gnu.org> | 2017-03-21 10:18:51 +0000 |
commit | d3e19c2c97facd63a5ae71a164b89a913beecf18 (patch) | |
tree | db3f380de30ffdfd1aa7daf16a7f82be7750a17a /gcc | |
parent | 3ed67fbf3d21c3d81f9d3107b1e07f970c9fac01 (diff) | |
download | gcc-d3e19c2c97facd63a5ae71a164b89a913beecf18.zip gcc-d3e19c2c97facd63a5ae71a164b89a913beecf18.tar.gz gcc-d3e19c2c97facd63a5ae71a164b89a913beecf18.tar.bz2 |
re PR c++/77752 (ICE on C++ code on x86_64-linux-gnu (internal compiler error: Segmentation fault, build_list_conv, implicit_conversion))
/cp
2017-03-21 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/77752
* name-lookup.c (pushtag_1): Add check for bogus, non template,
std::initializer_list.
/testsuite
2017-03-21 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/77752
* g++.dg/cpp0x/initlist97.C: New.
* g++.dg/cpp0x/initlist85.C: Update.
From-SVN: r246310
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/name-lookup.c | 9 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/initlist85.C | 6 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/initlist97.C | 7 |
5 files changed, 30 insertions, 4 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 20eaf63..3db9895 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2017-03-21 Paolo Carlini <paolo.carlini@oracle.com> + + PR c++/77752 + * name-lookup.c (pushtag_1): Add check for bogus, non template, + std::initializer_list. + 2017-03-21 Jakub Jelinek <jakub@redhat.com> PR c++/35878 diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c index 994f7f0..4d7d3a1 100644 --- a/gcc/cp/name-lookup.c +++ b/gcc/cp/name-lookup.c @@ -6207,6 +6207,15 @@ pushtag_1 (tree name, tree type, tag_scope scope) decl = pushdecl_with_scope_1 (decl, b, /*is_friend=*/false); if (decl == error_mark_node) return decl; + + if (DECL_CONTEXT (decl) == std_node + && strcmp (TYPE_NAME_STRING (type), "initializer_list") == 0 + && !CLASSTYPE_TEMPLATE_INFO (type)) + { + error ("declaration of std::initializer_list does not match " + "#include <initializer_list>, isn't a template"); + return error_mark_node; + } } if (! in_class) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 69cf112..a4d5873 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2017-03-21 Paolo Carlini <paolo.carlini@oracle.com> + + PR c++/77752 + * g++.dg/cpp0x/initlist97.C: New. + * g++.dg/cpp0x/initlist85.C: Update. + 2017-03-21 Jakub Jelinek <jakub@redhat.com> PR c/67338 diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist85.C b/gcc/testsuite/g++.dg/cpp0x/initlist85.C index fa4fb61..0b5ce49 100644 --- a/gcc/testsuite/g++.dg/cpp0x/initlist85.C +++ b/gcc/testsuite/g++.dg/cpp0x/initlist85.C @@ -3,14 +3,12 @@ namespace std { - struct initializer_list {}; // { dg-message "initializer_list" } + struct initializer_list {}; // { dg-error "declaration" } } void foo(std::initializer_list &); void f() { - foo({1, 2}); + foo({1, 2}); // { dg-error "invalid initialization" } } - -// { dg-prune-output "compilation terminated" } diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist97.C b/gcc/testsuite/g++.dg/cpp0x/initlist97.C new file mode 100644 index 0000000..be47415 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/initlist97.C @@ -0,0 +1,7 @@ +// PR c++/77752 +// { dg-do compile { target c++11 } } + +namespace std { + class initializer_list; // { dg-error "declaration" } +} +void f(std::initializer_list l) { f({2}); } // { dg-error "incomplete type" } |