mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-03-22 23:01:17 +08:00
re PR c++/43079 (ICE with incompatible pointer-to-member-function as template parameter)
PR c++/43079 * pt.c (convert_nontype_argument): Change assert to test. From-SVN: r156839
This commit is contained in:
parent
af14c87be9
commit
d29760adf9
@ -1,3 +1,8 @@
|
||||
2010-02-17 Jason Merrill <jason@redhat.com>
|
||||
|
||||
PR c++/43079
|
||||
* pt.c (convert_nontype_argument): Change assert to test.
|
||||
|
||||
2010-02-16 Jason Merrill <jason@redhat.com>
|
||||
|
||||
* cp-gimplify.c (cp_gimplify_expr): Fix error recovery.
|
||||
|
@ -5128,12 +5128,13 @@ convert_nontype_argument (tree type, tree expr)
|
||||
provide a superior diagnostic. */
|
||||
if (!same_type_p (TREE_TYPE (expr), type))
|
||||
{
|
||||
/* Make sure we are just one standard conversion off. */
|
||||
gcc_assert (can_convert (type, TREE_TYPE (expr)));
|
||||
error ("%qE is not a valid template argument for type %qT "
|
||||
"because it is of type %qT", expr, type,
|
||||
TREE_TYPE (expr));
|
||||
inform (input_location, "standard conversions are not allowed in this context");
|
||||
/* If we are just one standard conversion off, explain. */
|
||||
if (can_convert (type, TREE_TYPE (expr)))
|
||||
inform (input_location,
|
||||
"standard conversions are not allowed in this context");
|
||||
return NULL_TREE;
|
||||
}
|
||||
}
|
||||
|
@ -1,3 +1,8 @@
|
||||
2010-02-17 Jason Merrill <jason@redhat.com>
|
||||
|
||||
PR c++/43079
|
||||
* g++.dg/template/ptrmem20.C: New.
|
||||
|
||||
2010-02-17 Uros Bizjak <ubizjak@gmail.com>
|
||||
|
||||
PR target/43103
|
||||
|
16
gcc/testsuite/g++.dg/template/ptrmem20.C
Normal file
16
gcc/testsuite/g++.dg/template/ptrmem20.C
Normal file
@ -0,0 +1,16 @@
|
||||
// PR c++/43079
|
||||
|
||||
struct A {};
|
||||
|
||||
struct B
|
||||
{
|
||||
void foo() const;
|
||||
void foo();
|
||||
};
|
||||
|
||||
template<void (A::*)()> void bar();
|
||||
|
||||
void baz()
|
||||
{
|
||||
bar<&B::foo>(); // { dg-error "not a valid template argument|no match" }
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user