This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/29332] No error given for derived-to-inaccessible-base conversion in default arg.
- From: "widman at gimpel dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 3 Oct 2006 16:38:20 -0000
- Subject: [Bug c++/29332] No error given for derived-to-inaccessible-base conversion in default arg.
- References: <bug-29332-10061@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #2 from widman at gimpel dot com 2006-10-03 16:38 -------
Ok, here's something that's a little closer to the original example:
class A;
class B;
extern B b;
struct C {
static int f( A& = b); // ERROR
};
class A{};
class B : public A {};
int n = C::f();
Failing to report this error doesn't appear to lead to a "real" bug, but it's
still ill-formed, so when you try to port your code to a compiler with the EDG
front end, you'll get:
error: a reference of type "A &" (not const-qualified) cannot
be initialized with a value of type "B"
static int f( A& = b); // ERROR
^
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29332