summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.old-deja/g++.benjamin/tem05.C
blob: 7b6b955383b956c6951231f932a02b24ff25eb2c (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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
// { dg-do assemble  }
// 980924 bkoz
// just a quick test for export, to make sure we are warning for it.
// CHANGE ME when it's supported


// 14 Templates
//p 6
// A namespace-scope declaration or definintion of a non-line function
// template, a non-inline member function template, a non-inline
// member function of a class template or a static data member of a
// class template may be preceeded by the export keyword. If such a
// template is defined in the same translation unit in which it is
// declared as exported, the definition is considered to be
// exported. The first declaration of the template containing the
// export keyword must not follow the definition. (meaning that export
// can't beredeclared as non-export??)

// 1
// template definition
export template <class T>  // { dg-warning "" } 
bool templ_one(T a) {
   if (a > 0)
     return true;
   else
     return false;
}


// 2
// static data, mf, mf template
template <class T>
class X_one {
  unsigned short	id;
  T	type;
public:
  static const bool 	is_specialized ;

  X_one(const unsigned short& us = 5): id(us), type(T(0)) {}
  unsigned short ret_id ();
  template <class T2> bool compare_ge(T2 test);
};

export template <class T> // { dg-warning "" } 
const bool X_one<T>::is_specialized = false;

export template <class T> // { dg-warning "" } 
unsigned short X_one<T>::ret_id() {
  return id;
}

export template <class T2> // { dg-warning "" } 
bool compare_ge(T2 test) {
  if (test > type) // { dg-error "" } .*
    return true;
  return false;
}