Commit 38ffa828 by Jason Merrill Committed by Jason Merrill

re PR c++/46220 (Error: invalid covariant return type generated for incomplete…

re PR c++/46220 (Error: invalid covariant return type generated for incomplete class type and different qualifer)

	PR c++/46220
	* search.c (check_final_overrider): Allow pointer to same incomplete
	class type with different cv-quals.

From-SVN: r170676
parent 08707076
2011-03-04 Jason Merrill <jason@redhat.com>
PR c++/46220
* search.c (check_final_overrider): Allow pointer to same incomplete
class type with different cv-quals.
2011-03-03 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/47974
......
......@@ -1835,12 +1835,18 @@ check_final_overrider (tree overrider, tree basefn)
if (CLASS_TYPE_P (base_return) && CLASS_TYPE_P (over_return))
{
/* Strictly speaking, the standard requires the return type to be
complete even if it only differs in cv-quals, but that seems
like a bug in the wording. */
if (!same_type_ignoring_top_level_qualifiers_p (base_return, over_return))
{
tree binfo = lookup_base (over_return, base_return,
ba_check | ba_quiet, NULL);
if (!binfo)
fail = 1;
}
}
else if (!pedantic
&& can_convert (TREE_TYPE (base_type), TREE_TYPE (over_type)))
/* GNU extension, allow trivial pointer conversions such as
......
2011-03-04 Jason Merrill <jason@redhat.com>
* g++.dg/inherit/covariant19.C: New.
2011-03-04 Richard Guenther <rguenther@suse.de>
PR middle-end/47968
......
// PR c++/46220
// According to the letter of the standard this is invalid,
// but that seems like a bug.
class Baz;
class Foo {
public:
virtual const Baz* getBaz() = 0;
};
class Bar : public Foo {
public:
Baz* getBaz();
};
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