Bug 78852 - [7 Regression] ICE with Boost.Variant 1.62
Summary: [7 Regression] ICE with Boost.Variant 1.62
Status: RESOLVED DUPLICATE of bug 78767
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 7.0
: P1 normal
Target Milestone: 7.0
Assignee: Not yet assigned to anyone
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2016-12-18 18:21 UTC by Igor R.
Modified: 2017-01-11 10:51 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2016-12-18 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Igor R. 2016-12-18 18:21:43 UTC
GCC crashes, when compiling the following code with Boost 1.62:

#include <boost/variant.hpp>

template<class Node>
struct node1_type;

struct var_type;

using var_base = boost::variant<int, 
  boost::recursive_wrapper<node1_type<var_type>>
>;

template<class Node>
struct node1_type
{
 Node child;
};

struct var_type : var_base
{
  using var_base::var_base;
};

int main()
{
  var_type v1 = 1;
}

//////////

prog.cc: In function 'int main()':
prog.cc:25:17: internal compiler error: in push_access_scope, at cp/pt.c:228
   var_type v1 = 1;
                 ^
0x603dc7 push_access_scope
	/home/heads/gcc/gcc-source/gcc/cp/pt.c:227
0x61c267 tsubst_default_argument(tree_node*, tree_node*, tree_node*, int)
	/home/heads/gcc/gcc-source/gcc/cp/pt.c:11668
0x5d5948 convert_default_arg(tree_node*, tree_node*, tree_node*, int, int)
	/home/heads/gcc/gcc-source/gcc/cp/call.c:7256
0x5daac5 build_over_call
	/home/heads/gcc/gcc-source/gcc/cp/call.c:7839
0x5d7b2a convert_like_real
	/home/heads/gcc/gcc-source/gcc/cp/call.c:6702
0x5d7c46 convert_like_real
	/home/heads/gcc/gcc-source/gcc/cp/call.c:6830
0x5df8b7 build_user_type_conversion(tree_node*, tree_node*, int, int)
	/home/heads/gcc/gcc-source/gcc/cp/call.c:3987
0x6a1a15 ocp_convert(tree_node*, tree_node*, int, int, int)
	/home/heads/gcc/gcc-source/gcc/cp/cvt.c:881
0x6a9a75 expand_default_init
	/home/heads/gcc/gcc-source/gcc/cp/init.c:1715
0x6a9a75 expand_aggr_init_1
	/home/heads/gcc/gcc-source/gcc/cp/init.c:1894
0x6a9da9 build_aggr_init(tree_node*, tree_node*, int, int)
	/home/heads/gcc/gcc-source/gcc/cp/init.c:1633
0x5f3cb5 build_aggr_init_full_exprs
	/home/heads/gcc/gcc-source/gcc/cp/decl.c:6159
0x5f3cb5 check_initializer
	/home/heads/gcc/gcc-source/gcc/cp/decl.c:6307
0x5f71ab cp_finish_decl(tree_node*, tree_node*, bool, tree_node*, int)
	/home/heads/gcc/gcc-source/gcc/cp/decl.c:7019
0x684ea9 cp_parser_init_declarator
	/home/heads/gcc/gcc-source/gcc/cp/parser.c:19339
0x6854ed cp_parser_simple_declaration
	/home/heads/gcc/gcc-source/gcc/cp/parser.c:12757
0x686065 cp_parser_block_declaration
	/home/heads/gcc/gcc-source/gcc/cp/parser.c:12592
0x686969 cp_parser_declaration_statement
	/home/heads/gcc/gcc-source/gcc/cp/parser.c:12201
0x66885f cp_parser_statement
	/home/heads/gcc/gcc-source/gcc/cp/parser.c:10688
0x6694fd cp_parser_statement_seq_opt
	/home/heads/gcc/gcc-source/gcc/cp/parser.c:11020
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
Comment 1 Markus Trippelsdorf 2016-12-18 19:35:19 UTC
Original testcase ICEs with all supported gcc versions.

Here is a small testcase that only ICEs on trunk:

template <typename...> struct A { template <class T> A(T, int = 0); };
using var_base = A<>;
struct B : var_base {
  using var_base::var_base;
};
int main() { B a = 0; }
Comment 2 Markus Trippelsdorf 2016-12-19 09:10:44 UTC
The small testcase started to ICE with r241843:

commit 6e1e09d49b0fd596a0654f56dd35e2f36802a31b
Author: jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Fri Nov 4 12:47:01 2016 +0000

            PR c++/78198 - inherited template ctor with default arg
Comment 3 Marek Polacek 2017-01-11 10:08:36 UTC
The testcase in Comment 1 doesn't ICE for me with trunk.
Comment 4 Markus Trippelsdorf 2017-01-11 10:14:24 UTC
(In reply to Marek Polacek from comment #3)
> The testcase in Comment 1 doesn't ICE for me with trunk.

Yes, even the original testcase doesn't ICE anymore on trunk.
Would be good to know which revision fixed the issue.
Comment 5 Marek Polacek 2017-01-11 10:17:45 UTC
Right, let me see.
Comment 6 Marek Polacek 2017-01-11 10:46:15 UTC
Fixed by:

commit 01b78b99465162b381f6d36aae72e2c7e598fb59
Author: jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Wed Dec 21 19:10:23 2016 +0000

            PR c++/78767 - ICE with inherited constructor default argument
    
            * method.c (strip_inheriting_ctors): Strip template as appropriate.
    
    git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@243864 138bc75d-0d04-0410-961f-82ee72b054a4


This is a dup of c++/78767, closing.
Comment 7 Markus Trippelsdorf 2017-01-11 10:51:28 UTC
(In reply to Marek Polacek from comment #6)
> Fixed by:
> 
> commit 01b78b99465162b381f6d36aae72e2c7e598fb59
> Author: jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
> Date:   Wed Dec 21 19:10:23 2016 +0000
> 
>             PR c++/78767 - ICE with inherited constructor default argument
>     
>             * method.c (strip_inheriting_ctors): Strip template as
> appropriate.
>     
>     git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@243864
> 138bc75d-0d04-0410-961f-82ee72b054a4
> 
> 
> This is a dup of c++/78767, closing.

Well, gcc-5 and gcc-6 still crash, so the fix should be backported.

*** This bug has been marked as a duplicate of bug 78767 ***