re PR c++/27801 (ICE in invert_truthvalue with template)
PR c++/27801 * call.c (perform_implicit_conversion): Do not actually perform conversions in templates. PR c++/26496 * call.c (resolve_args): Check for invalid uses of bound non-static member functions. * init.c (build_offset_ref): Return error_mark_node for errors. PR c++/27385 * decl.c (reshape_init): Robustify. (reshape_init_array_1): Likewise. PR c++/27801 * g++.dg/template/cond6.C: New test. PR c++/26496 * g++.dg/template/crash51.C: New test. * g++.old-deja/g++.mike/net36.C: Tweak error markers. PR c++/27385 * g++.dg/init/array20.C: New test. From-SVN: r114278
This commit is contained in:
parent
69037dd991
commit
07471dfbf7
@ -1,3 +1,18 @@
|
||||
2006-05-31 Mark Mitchell <mark@codesourcery.com>
|
||||
|
||||
PR c++/27801
|
||||
* call.c (perform_implicit_conversion): Do not actually perform
|
||||
conversions in templates.
|
||||
|
||||
PR c++/26496
|
||||
* call.c (resolve_args): Check for invalid uses of bound
|
||||
non-static member functions.
|
||||
* init.c (build_offset_ref): Return error_mark_node for errors.
|
||||
|
||||
PR c++/27385
|
||||
* decl.c (reshape_init): Robustify.
|
||||
(reshape_init_array_1): Likewise.
|
||||
|
||||
2006-05-30 Mark Mitchell <mark@codesourcery.com>
|
||||
|
||||
PR c++/27808
|
||||
|
@ -2704,6 +2704,8 @@ resolve_args (tree args)
|
||||
error ("invalid use of void expression");
|
||||
return error_mark_node;
|
||||
}
|
||||
else if (invalid_nonstatic_memfn_p (arg))
|
||||
return error_mark_node;
|
||||
}
|
||||
return args;
|
||||
}
|
||||
@ -6388,6 +6390,14 @@ perform_implicit_conversion (tree type, tree expr)
|
||||
error ("could not convert %qE to %qT", expr, type);
|
||||
expr = error_mark_node;
|
||||
}
|
||||
else if (processing_template_decl)
|
||||
{
|
||||
/* In a template, we are only concerned about determining the
|
||||
type of non-dependent expressions, so we do not have to
|
||||
perform the actual conversion. */
|
||||
if (TREE_TYPE (expr) != type)
|
||||
expr = build_nop (type, expr);
|
||||
}
|
||||
else
|
||||
expr = convert_like (conv, expr);
|
||||
|
||||
|
@ -4352,6 +4352,8 @@ reshape_init_array_1 (tree elt_type, tree max_index, reshape_iter *d)
|
||||
}
|
||||
|
||||
elt_init = reshape_init_r (elt_type, d, /*first_initializer_p=*/false);
|
||||
if (elt_init == error_mark_node)
|
||||
return error_mark_node;
|
||||
CONSTRUCTOR_APPEND_ELT (CONSTRUCTOR_ELTS (new_init), NULL_TREE, elt_init);
|
||||
}
|
||||
|
||||
@ -4630,6 +4632,8 @@ reshape_init (tree type, tree init)
|
||||
d.end = d.cur + VEC_length (constructor_elt, v);
|
||||
|
||||
new_init = reshape_init_r (type, &d, true);
|
||||
if (new_init == error_mark_node)
|
||||
return error_mark_node;
|
||||
|
||||
/* Make sure all the element of the constructor were used. Otherwise,
|
||||
issue an error about exceeding initializers. */
|
||||
|
@ -1426,7 +1426,7 @@ build_offset_ref (tree type, tree member, bool address_p)
|
||||
}
|
||||
error ("invalid use of non-static member function %qD",
|
||||
TREE_OPERAND (member, 1));
|
||||
return member;
|
||||
return error_mark_node;
|
||||
}
|
||||
else if (TREE_CODE (member) == FIELD_DECL)
|
||||
{
|
||||
|
@ -1,3 +1,15 @@
|
||||
2006-05-31 Mark Mitchell <mark@codesourcery.com>
|
||||
|
||||
PR c++/27801
|
||||
* g++.dg/template/cond6.C: New test.
|
||||
|
||||
PR c++/26496
|
||||
* g++.dg/template/crash51.C: New test.
|
||||
* g++.old-deja/g++.mike/net36.C: Tweak error markers.
|
||||
|
||||
PR c++/27385
|
||||
* g++.dg/init/array20.C: New test.
|
||||
|
||||
2006-05-31 Roger Sayle <roger@eyesopen.com>
|
||||
|
||||
* gcc.dg/builtins-54.c: New test case.
|
||||
|
5
gcc/testsuite/g++.dg/init/array20.C
Normal file
5
gcc/testsuite/g++.dg/init/array20.C
Normal file
@ -0,0 +1,5 @@
|
||||
// PR c++/27385
|
||||
|
||||
struct A {};
|
||||
A a[] = { 0 }; // { dg-error "initializer" }
|
||||
|
6
gcc/testsuite/g++.dg/template/cond6.C
Normal file
6
gcc/testsuite/g++.dg/template/cond6.C
Normal file
@ -0,0 +1,6 @@
|
||||
// PR c++/27801
|
||||
|
||||
template<int> int foo(int i)
|
||||
{
|
||||
return !( (1 && i) ? 0 : 1 );
|
||||
}
|
11
gcc/testsuite/g++.dg/template/crash51.C
Normal file
11
gcc/testsuite/g++.dg/template/crash51.C
Normal file
@ -0,0 +1,11 @@
|
||||
// PR c++/26496
|
||||
|
||||
template< typename _Generator> int generate_n(_Generator __gen);
|
||||
struct Distribution { };
|
||||
typedef double (Distribution::* Pstd_mem)();
|
||||
int main(void)
|
||||
{
|
||||
Distribution* rng;
|
||||
Pstd_mem ptr;
|
||||
generate_n(rng->*ptr); // { dg-error "non-static member" }
|
||||
}
|
@ -11,7 +11,7 @@ typedef void (A::*handler) (X*);
|
||||
|
||||
class B {
|
||||
public:
|
||||
void setHandler(handler); // { dg-error "candidate" }
|
||||
void setHandler(handler);
|
||||
};
|
||||
|
||||
void f(B* b) {
|
||||
|
Loading…
Reference in New Issue
Block a user