aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@codesourcery.com>2007-07-22 18:46:51 +0000
committerNathan Sidwell <nathan@gcc.gnu.org>2007-07-22 18:46:51 +0000
commit823c22f9eacdc9b5519a561eb2506d32fab41b37 (patch)
tree023599cfcc1f7ed7a4850379b0fc219cd48e8482 /gcc/cp
parenteec14ce5ec901fc2bab2cc8b25b5ec6c8f9ce3d5 (diff)
downloadgcc-823c22f9eacdc9b5519a561eb2506d32fab41b37.zip
gcc-823c22f9eacdc9b5519a561eb2506d32fab41b37.tar.gz
gcc-823c22f9eacdc9b5519a561eb2506d32fab41b37.tar.bz2
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
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog4
-rw-r--r--gcc/cp/typeck.c10
2 files changed, 12 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 6faa01f..39da6aa 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,9 @@
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
* typeck.c (structural_comptypes): No need to check
resolve_typename_type return value here.
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index 7e59ec3..7a1a725 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -2885,8 +2885,14 @@ convert_arguments (int nargs, tree *argarray,
if (typetail != 0 && typetail != void_list_node)
{
- /* See if there are default arguments that can be used. */
- if (TREE_PURPOSE (typetail)
+ /* See if there are default arguments that can be used. Because
+ 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)
{
for (; typetail != void_list_node; ++i)