Debian Codegraph @

gcc/testsuite/g++.dg/parse/non-dependent2.C

raw
1 // { dg-do compile }
2
3 // Copyright (C) 2003 Free Software Foundation, Inc.
4 // Contributed by Nathan Sidwell 16 Jul 2003 <[email protected]>
5
6 // A non-dependent field_decl can bind at parse time.
7
8 template <class T>
9 struct Foo {
10 int j; // we never see this one.
11 int k; // { dg-message "Foo" }
12
13 };
14
15 struct Baz
16 {
17 int j;
18 int k; // { dg-message "candidates" }
19
20 };
21
22 template <class T>
23 struct Bar : public Foo<T>, Baz {
24
25 int baz () { return j; } // binds to Baz::j
26 int foo () { return this->k; } // { dg-error "request for member" }
27 };
28
29 int main()
30 {
31 Bar<int> bar;
32
33 bar.baz ();
34 bar.foo (); // { dg-message "required" }
35
36 return 0;
37 }