Commit 823c22f9 by Nathan Sidwell Committed by Nathan Sidwell

re PR c++/32839 (internal compiler error: Segmentation fault (templates))

cp/
	PR c++/32839
	* typeck.c (convert_arguments): Only use default args if we have
	a function decl.

testsuite/
	PR c++/32839
	* g++.dg/expr/call4.C: New.
	* g++.dg/expr/call5.C: New.

From-SVN: r126829
parent eec14ce5
2007-07-22 Nathan Sidwell <nathan@codesourcery.com> 2007-07-22 Nathan Sidwell <nathan@codesourcery.com>
PR c++/32839
* typeck.c (convert_arguments): Only use default args if we have
a function decl.
PR c++/30818 PR c++/30818
* typeck.c (structural_comptypes): No need to check * typeck.c (structural_comptypes): No need to check
resolve_typename_type return value here. resolve_typename_type return value here.
......
...@@ -2885,8 +2885,14 @@ convert_arguments (int nargs, tree *argarray, ...@@ -2885,8 +2885,14 @@ convert_arguments (int nargs, tree *argarray,
if (typetail != 0 && typetail != void_list_node) if (typetail != 0 && typetail != void_list_node)
{ {
/* See if there are default arguments that can be used. */ /* See if there are default arguments that can be used. Because
if (TREE_PURPOSE (typetail) we hold default arguments in the FUNCTION_TYPE (which is so
wrong), we can see default parameters here from deduced
contexts (and via typeof) for indirect function calls.
Fortunately we know whether we have a function decl to
provide default arguments in a language conformant
manner. */
if (fndecl && TREE_PURPOSE (typetail)
&& TREE_CODE (TREE_PURPOSE (typetail)) != DEFAULT_ARG) && TREE_CODE (TREE_PURPOSE (typetail)) != DEFAULT_ARG)
{ {
for (; typetail != void_list_node; ++i) for (; typetail != void_list_node; ++i)
......
2007-07-22 Nathan Sidwell <nathan@codesourcery.com>
PR c++/32839
* g++.dg/expr/call4.C: New.
* g++.dg/expr/call5.C: New.
2007-07-22 Daniel Franke <franke.daniel@gmail.com> 2007-07-22 Daniel Franke <franke.daniel@gmail.com>
PR fortran/32710 PR fortran/32710
// { dg-do compile }
// Copyright (C) 2007 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 22 Jul 2007 <nathan@codesourcery.com>
// Origin: Danny Boelens <danny.boelens@artwork-systems.com>
// PR 32839. Default arguments propagated through the type system to
// an indirect call.
template<typename T>
struct TPL
{
enum Whatever {e1, e2};
static void Quux (int i = e1 | e2);
};
template <typename F>
void DoIt (F fun)
{
fun (); // { dg-error "too few arguments" }
}
void Foo ()
{
DoIt (&TPL<int>::Quux);
}
// { dg-do compile }
// Copyright (C) 2007 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 22 Jul 2007 <nathan@codesourcery.com>
// PR 32839. Default arguments propagated through the type system to
// an indirect call.
void Quux (int i = 0);
void Baz (int i);
void Foo ()
{
__typeof (Quux) *q = Baz;
q (); // { dg-error "too few arguments" }
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment