PR c++/67876 - [6 Regression] ICE when compiling Firefox 38

gcc/cp
	* pt.c (convert_template_argument): Make sure number of tree
	operands is greater than zero before attempting to extract one.

gcc/testsuite/
	* g++.dg/pr67876.C: New test.

From-SVN: r230924
This commit is contained in:
Martin Sebor 2015-11-26 01:52:04 +00:00 committed by Martin Sebor
parent ae026741df
commit e82f9ef748
4 changed files with 46 additions and 2 deletions

View File

@ -1,3 +1,9 @@
2015-11-25 Martin Sebor <msebor@redhat.com>
PR c++/67876
* pt.c (convert_template_argument): Make sure number of tree
operands is greater than zero before attempting to extract one.
2015-11-25 Ryan Burn <contact@rnburn.com>
PR c++/68434
@ -369,10 +375,10 @@
(cp_parser_pragma): Adjust omp_declare_simd checking. Call
cp_ensure_no_oacc_routine.
(cp_parser_pragma): Add OpenACC routine handling.
2015-11-08 Martin Sebor <msebor@redhat.com>
PR c++/67942
PR c++/67942
* cp/init.c (warn_placement_new_too_small): Convert integer
operand of POINTER_PLUS_EXPR to ssize_t to determine its signed
value.

View File

@ -7234,6 +7234,7 @@ convert_template_argument (tree parm,
if (TREE_CODE (TREE_TYPE (inner)) == REFERENCE_TYPE
&& TREE_CODE (TREE_TYPE (TREE_TYPE (inner))) == FUNCTION_TYPE
&& TREE_CODE (TREE_TYPE (inner)) == REFERENCE_TYPE
&& 0 < TREE_OPERAND_LENGTH (inner)
&& reject_gcc_builtin (TREE_OPERAND (inner, 0)))
return error_mark_node;
}

View File

@ -1,3 +1,8 @@
2015-11-25 Martin Sebor <msebor@redhat.com>
PR c++/67876
* g++.dg/pr67876.C: New test.
2015-11-25 Aditya Kumar <aditya.k7@samsung.com>
Sebastian Pop <s.pop@samsung.com>

View File

@ -0,0 +1,32 @@
// PR c++/67876 - [6 Regression] ICE when compiling Firefox 38
// Caused by a patch for c/66516 - missing diagnostic on taking
// the address of a builtin function
// { dg-do compile }
template <class T, void (&F)(T*)>
struct S { };
extern void foo (int*);
template <class T, void (&F)(T*)>
void bar (S<T, F>&s) { }
S<int, foo> s;
void foobar (S<int, foo> &s) { bar (s); }
// PR c++/67876 - [6 Regression] ICE when compiling Firefox 38
// Caused by a patch for c/66516 - missing diagnostic on taking
// the address of a builtin function
// { dg-do compile }
template <class T, void (&F)(T*)>
struct S { };
extern void foo (int*);
template <class T, void (&F)(T*)>
void bar (S<T, F>&s) { }
S<int, foo> s;
void foobar (S<int, foo> &s) { bar (s); }