summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.old-deja/g++.oliva/overload1.C
blob: 91b3b02a439a654c57ae513ab037eda03114b887 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// { dg-do assemble  }

// Copyright (C) 1999 Free Software Foundation

// by Alexandre Oliva <oliva@lsd.ic.unicamp.br>
// Based on bug report by JDonner <jdonner@schedsys.com>

struct foo {
  static int bar(); // { dg-error "candidate" }
  void bar(int); // { dg-error "foo::bar" }
};

/* gcc emits a hard error without -pedantic, and a warning with
   -pedantic, even in bad1.  */
int (*ok1)() = foo::bar;
void (foo::*bad1)(int) = foo::bar; // { dg-error "assuming pointer" }
// { dg-message "note" "note" { target *-*-* } 16 }

int (*ok2)() = &foo::bar; // ok
void (*bad2)(int) = foo::bar; // { dg-error "no matches" }

void (foo::*ok3)(int) = &foo::bar; // ok
int (foo::*bad3)() = foo::bar; // { dg-error "no matches" }