From 554fd8c5195424bdbcabf5de30fdc183aba391bd Mon Sep 17 00:00:00 2001 From: upstream source tree Date: Sun, 15 Mar 2015 20:14:05 -0400 Subject: obtained gcc-4.6.4.tar.bz2 from upstream website; verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository. --- gcc/testsuite/g++.dg/template/dependent-expr5.C | 130 ++++++++++++++++++++++++ 1 file changed, 130 insertions(+) create mode 100644 gcc/testsuite/g++.dg/template/dependent-expr5.C (limited to 'gcc/testsuite/g++.dg/template/dependent-expr5.C') diff --git a/gcc/testsuite/g++.dg/template/dependent-expr5.C b/gcc/testsuite/g++.dg/template/dependent-expr5.C new file mode 100644 index 000000000..1e850cd54 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/dependent-expr5.C @@ -0,0 +1,130 @@ +// { dg-do compile } + +// Copyright 2005 Free Software Foundation +// contributed by Alexandre Oliva +// inspired in the failure reported in Red Hat bugzilla #168260. + +template void bind(F f) {} // { dg-message "note" } + +template void bindm(F f) {} // { dg-message "note" } +template void bindm(F (T::*f)(void)) {} // { dg-message "note" } + +template void bindn(F f) {} +template void bindn(F (*f)(T)) {} + +template void bindb(F f) {} +template void bindb(F (*f)(T)) {} // { dg-message "note" } +template void bindb(F (T::*f)(void)) {} // { dg-message "note" } + +struct foo { + static int baist; + int bait; // { dg-error "non-static data member" } + void barf (); + static void barf (int); + + struct bar { + static int baikst; + int baikt; + void bark (); + static void bark (int); + + bar() { + bind (&baist); + bind (&foo::baist); + bind (&bait); // { dg-error "from this location" } + bind (&foo::bait); + + bind (&baikst); + bind (&bar::baikst); + bind (&baikt); // ok, this->baikt + bind (&bar::baikt); + + bind (&barf); // { dg-error "no matching function" } + // { dg-message "candidate" "candidate note" { target *-*-* } 42 } + bind (&foo::barf); // { dg-error "no matching function" } + // { dg-message "candidate" "candidate note" { target *-*-* } 44 } + + bindm (&barf); // { dg-error "no matching function" } + // { dg-message "candidate" "candidate note" { target *-*-* } 47 } + bindm (&foo::barf); + + bindn (&barf); + bindn (&foo::barf); + + bindb (&barf); + bindb (&foo::barf); // { dg-error "ambiguous" } + // { dg-message "candidate" "candidate note" { target *-*-* } 55 } + + bind (&bark); // { dg-error "no matching function" } + // { dg-message "candidate" "candidate note" { target *-*-* } 58 } + bind (&bar::bark); // { dg-error "no matching function" } + // { dg-message "candidate" "candidate note" { target *-*-* } 60 } + + bindm (&bark); // { dg-error "no matching function" } + // { dg-message "candidate" "candidate note" { target *-*-* } 63 } + bindm (&bar::bark); + + bindn (&bark); + bindn (&bar::bark); + + bindb (&bark); + bindb (&bar::bark); // { dg-error "ambiguous" } + // { dg-message "candidate" "candidate note" { target *-*-* } 71 } + } + }; + + template + struct barT { + static int baikst; + int baikt; + void bark (); + static void bark (int); + + barT() { + bind (&baist); + bind (&foo::baist); + bind (&bait); // { dg-error "from this location" } + bind (&foo::bait); + + bind (&baikst); + bind (&barT::baikst); + bind (&baikt); // ok, this->baikt + bind (&barT::baikt); + + bind (&barf); // { dg-error "no matching function" } + // { dg-message "candidate" "candidate note" { target *-*-* } 94 } + bind (&foo::barf); // { dg-error "no matching function" } + // { dg-message "candidate" "candidate note" { target *-*-* } 96 } + + bindm (&barf); // { dg-error "no matching function" } + // { dg-message "candidate" "candidate note" { target *-*-* } 99 } + bindm (&foo::barf); + + bindn (&barf); + bindn (&foo::barf); + + bindb (&barf); + bindb (&foo::barf); // { dg-error "ambiguous" } + // { dg-message "candidate" "candidate note" { target *-*-* } 107 } + + bind (&bark); // { dg-error "no matching function" } + // { dg-message "candidate" "candidate note" { target *-*-* } 110 } + bind (&barT::bark); // { dg-error "no matching function" } + // { dg-message "candidate" "candidate note" { target *-*-* } 112 } + + bindm (&bark); // { dg-error "no matching function" } + // { dg-message "candidate" "candidate note" { target *-*-* } 115 } + bindm (&barT::bark); + + bindn (&bark); + bindn (&barT::bark); + + bindb (&bark); + bindb (&barT::bark); // { dg-error "ambiguous" } + // { dg-message "candidate" "candidate note" { target *-*-* } 123 } + } + }; + + bar bard; + barT bart; +} bad; -- cgit v1.2.3