OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [g++.dg/] [tc1/] [dr166.C] - Blame information for rev 307

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 301 jeremybenn
// { dg-do compile }
2
// Origin: Giovanni Bajo 
3
// DR166: Friend declarations of template-ids
4
 
5
namespace N {
6
  template  void f(T);
7
  void g();
8
 
9
  namespace M {
10
    class A {
11
      friend void f(int); // N::f
12
      static int x;   // { dg-error "private" }
13
    };
14
 
15
    class B {
16
      template  friend void f(T);  // M::f
17
      static int x;   // { dg-error "private" }
18
    };
19
 
20
    class C {
21
      friend void g(); // M::g
22
      static int x;   // { dg-error "private" }
23
    };
24
 
25
    template  void f(T)  // will be instantiated as f
26
    {
27
      M::A::x = 0;    // { dg-error "within this context" }
28
      M::B::x = 0;
29
    }
30
    template <> void f(int)
31
    { M::A::x = 0; }      // { dg-error "within this context" }
32
    template <> void f(double )
33
    {
34
      M::B::x = 0;
35
      M::f(0);   // { dg-message "instantiated" }
36
    }
37
 
38
    void g(void)
39
    { M::C::x = 0; }
40
  }
41
 
42
  template  void f(T)  // will be instantiated as f
43
  {
44
    M::A::x = 0;       // { dg-error "within this context" }
45
    M::B::x = 0;       // { dg-error "within this context" }
46
  }
47
 
48
  template <> void f(int )
49
  {
50
    N::f(0);        // { dg-message "instantiated" }
51
    M::A::x = 0;
52
    M::B::x = 0;       // { dg-error "within this context" }
53
  }
54
 
55
  template <> void f(char )
56
  { M::A::x = 0; }      // { dg-error "within this context" }
57
 
58
  void g(void)
59
  { M::C::x = 0; }      // { dg-error "within this context" }
60
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.