Bug 68726 - ice: tree check: expected tree_vec, have error_mark in comp_template_args_with_info, at cp/pt.c:7890
Summary: ice: tree check: expected tree_vec, have error_mark in comp_template_args_wit...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 6.0
: P3 normal
Target Milestone: 6.0
Assignee: Not yet assigned to anyone
URL:
Keywords: error-recovery, ice-on-invalid-code
Depends on:
Blocks:
 
Reported: 2015-12-05 18:51 UTC by John Regehr
Modified: 2016-02-11 11:49 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2015-12-16 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description John Regehr 2015-12-05 18:51:18 UTC
ICE on invalid code


$ g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/home/regehr/z/compiler-install/gcc-r231259-install/libexec/gcc/x86_64-pc-linux-gnu/6.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /home/regehr/z/compiler-source/gcc/configure --prefix=/home/regehr/z/compiler-install/gcc-r231259-install --disable-bootstrap --disable-multilib --enable-languages=c,c++
Thread model: posix
gcc version 6.0.0 20151204 (experimental) (GCC) 


$ cat hello.cpp
template <typename> struct A {
  template <typename, > struct __construct_helper;
  template <typename... _Args>
  using __has_construct typename __construct_helper<_Args...>::type;
} struct : A<int> {


$ g++ -w -std=c++11 hello.cpp
hello.cpp:2:23: error: expected identifier before ‘>’ token
   template <typename, > struct __construct_helper;
                       ^

hello.cpp:4:25: error: expected ‘=’ before ‘typename’
   using __has_construct typename __construct_helper<_Args...>::type;
                         ^~~~~~~~

hello.cpp:5:1: error: expected ‘;’ after struct definition
 } struct : A<int> {
 ^

hello.cpp: In instantiation of ‘struct A<int>’:
hello.cpp:5:12:   required from here
hello.cpp:4:68: internal compiler error: tree check: expected tree_vec, have error_mark in comp_template_args_with_info, at cp/pt.c:7890
   using __has_construct typename __construct_helper<_Args...>::type;
                                                                    ^

0xf5cd5c tree_check_failed(tree_node const*, char const*, int, char const*, ...)
	/home/regehr/z/compiler-source/gcc/gcc/tree.c:9599
0x5fa12d tree_check
	/home/regehr/z/compiler-source/gcc/gcc/tree.h:2997
0x5fa12d comp_template_args_with_info
	/home/regehr/z/compiler-source/gcc/gcc/cp/pt.c:7890
0x63ada2 comp_template_args
	/home/regehr/z/compiler-source/gcc/gcc/cp/pt.c:7916
0x63ada2 lookup_template_class_1
	/home/regehr/z/compiler-source/gcc/gcc/cp/pt.c:8534
0x63ada2 lookup_template_class(tree_node*, tree_node*, tree_node*, tree_node*, int, int)
	/home/regehr/z/compiler-source/gcc/gcc/cp/pt.c:8611
0x63dcd1 tsubst_aggr_type
	/home/regehr/z/compiler-source/gcc/gcc/cp/pt.c:11280
0x625922 tsubst(tree_node*, tree_node*, int, tree_node*)
	/home/regehr/z/compiler-source/gcc/gcc/cp/pt.c:13267
0x62ed4d tsubst_decl
	/home/regehr/z/compiler-source/gcc/gcc/cp/pt.c:12166
0x6261fc tsubst(tree_node*, tree_node*, int, tree_node*)
	/home/regehr/z/compiler-source/gcc/gcc/cp/pt.c:12664
0x62e922 tsubst_decl
	/home/regehr/z/compiler-source/gcc/gcc/cp/pt.c:11506
0x6261fc tsubst(tree_node*, tree_node*, int, tree_node*)
	/home/regehr/z/compiler-source/gcc/gcc/cp/pt.c:12664
0x65aab2 instantiate_class_template_1
	/home/regehr/z/compiler-source/gcc/gcc/cp/pt.c:9976
0x65aab2 instantiate_class_template(tree_node*)
	/home/regehr/z/compiler-source/gcc/gcc/cp/pt.c:10253
0x706ccb complete_type(tree_node*)
	/home/regehr/z/compiler-source/gcc/gcc/cp/typeck.c:131
0x706ecf complete_type_or_maybe_complain(tree_node*, tree_node*, int)
	/home/regehr/z/compiler-source/gcc/gcc/cp/typeck.c:143
0x5ce159 xref_basetypes(tree_node*, tree_node*)
	/home/regehr/z/compiler-source/gcc/gcc/cp/decl.c:12806
0x6c74ea cp_parser_class_head
	/home/regehr/z/compiler-source/gcc/gcc/cp/parser.c:21525
0x6c74ea cp_parser_class_specifier_1
	/home/regehr/z/compiler-source/gcc/gcc/cp/parser.c:20785
0x6c85d9 cp_parser_class_specifier
	/home/regehr/z/compiler-source/gcc/gcc/cp/parser.c:21081
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 Paolo Carlini 2016-02-10 22:13:14 UTC
Mine.
Comment 2 paolo@gcc.gnu.org 2016-02-11 11:45:23 UTC
Author: paolo
Date: Thu Feb 11 11:44:51 2016
New Revision: 233339

URL: https://gcc.gnu.org/viewcvs?rev=233339&root=gcc&view=rev
Log:
/cp
2016-02-11  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/68726
	* pt.c (lookup_template_class_1): Check tsubst return value for
	error_mark_node.

/testsuite
2016-02-11  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/68726
	* g++.dg/cpp0x/pr68726.C: New.

Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/pr68726.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/testsuite/ChangeLog
Comment 3 paolo@gcc.gnu.org 2016-02-11 11:45:55 UTC
Author: paolo
Date: Thu Feb 11 11:45:10 2016
New Revision: 233340

URL: https://gcc.gnu.org/viewcvs?rev=233340&root=gcc&view=rev
Log:
/cp
2016-02-11  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/68726
	* pt.c (lookup_template_class_1): Check tsubst return value for
	error_mark_node.

/testsuite
2016-02-11  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/68726
	* g++.dg/cpp0x/pr68726.C: New.

Modified:
    trunk/gcc/cp/pt.c
Comment 4 Paolo Carlini 2016-02-11 11:49:58 UTC
Fixed.