// 981203 bkoz
// g++/14687
-// excess errors test - XFAIL *-*-*
#include <assert.h>
unsigned int gtest;
void foo() {
// straight call
C x;
- x.A::ii = 5;
- x.A::foo(x.A::ii);
+ x.A::ii = 5; // ERROR - L is ambiguous base
+ x.A::foo(x.A::ii); // ERROR - L is ambiguous base
// 5.1 Primary expressions
// p 8
// Build don't link:
// GROUPS passed miscellaneous-bugs
-// we shouldn't get any warnings or errors for this code
+
struct A {
int aa;
};
struct C : public A {
};
struct D : public C, public B {
- void fun() { C::aa = 10; }
+ void fun() { C::aa = 10; } // ERROR - conversion to A is ambiguous
};
// GROUPS passed templates
// Bug: g++ emits template instances when it shouldn't.
-// Special g++ Options: -g -Wno-deprecated -fexternal-templates
+// Special g++ Options: -g -O0 -Wno-deprecated -fexternal-templates
// We mark this XFAIL because we can't test for expected linker errors.
// If we get an XPASS for this testcase, that's a bug.
class Y : private X {
public:
- void f(int);// ERROR - because.*
- X::f; // g++ 2.5.5 doesn't flag this misuse
-};// ERROR - cannot adjust.*
+ void f(int);
+ X::f; // used to be an error; now equivalent to 'using X::f'
+};
--- /dev/null
+// Test that referring to an ambiguous base in name lookup does not
+// interfere with accessing the field, which is not ambiguous.
+
+// Build don't link:
+
+struct A {
+ int i;
+};
+struct B: virtual A { };
+struct C: public B { };
+struct D: public B { };
+struct E: public C, public D {
+ void f ();
+};
+
+void E::f() {
+ B::i = 0;
+}
+
+void f () {
+ E e;
+ e.B::i = 0;
+}
struct Y:X{
void f(int);
- void f(); // ERROR - conflict
+ void f();
using X::f;
-}; // ERROR -
+};
// Based on a testcase by Martin Bachtold <martinb@coyotesystems.com>
-// excess errors test - XFAIL *-*-*
-
struct foo {
void m();
};
--- /dev/null
+// Test of class-scope using-declaration for functions.
+
+#define assert(COND) if (!(COND)) return 1
+
+struct A {
+ int f(int) { return 1; }
+ int f(char) { return 2; }
+};
+
+struct B {
+ int f(double) { return 3; }
+};
+
+struct C : public A, public B {
+ using A::f;
+ using B::f;
+ int f(char) { return 4; }
+ int f(C) { return 5; }
+};
+
+int main ()
+{
+ C c;
+
+ assert (c.f(1) == 1);
+ assert (c.f('a') == 4);
+ assert (c.f(2.0) == 3);
+ assert (c.f(c) == 5);
+}
// Build don't link:
-// crash test - XFAIL *-*-*
// by Paul Burchard <burchard@pobox.com>, Level Set Systems, Inc.
// Copyright (C) 1999 Free Software Foundation
};
template<template<class> class XX>
class Y {
- XX<int> x_;
+ XX<int> x_; // ERROR - Q::X not a template
};
-Y<Q::X> y;
+Y<Q::X> y; // ERROR - instantiated from here