~ubuntu-branches/ubuntu/maverick/aspectc++/maverick

« back to all changes in this revision

Viewing changes to Puma/tests/bug340/bug340-3.cc

  • Committer: Bazaar Package Importer
  • Author(s): Reinhard Tartler
  • Date: 2008-04-10 17:40:52 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20080410174052-xdnsm7oi8hauyyf1
Tags: 1.0pre4~svn.20080409+dfsg-3
Fix another missing include, this time in Ag++/StdSystem.cc

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
template<class T> struct A { A(){}; };
 
2
template<class T,class S> struct B { B(){}; };
 
3
template<class T> void f(T, char = 1) {}
 
4
template<class T> void f(T*, long = 2) {}
 
5
template<class T> void f(const T*, short = 3) {}
 
6
template<class T> void g(T) {}
 
7
template<class T> void g(T&) {}
 
8
template<class T> void h(const T&) {}
 
9
template<class T> void h(A<T>&) {}
 
10
template<class T> void l(B<T,T>&) {}
 
11
template<class T> void l(B<T,int>&) {}
 
12
 
 
13
int main() {
 
14
  const int *p; 
 
15
  f(p);                 // f(const T*) is more specialized than f(T) or f(T*)
 
16
 
 
17
  float x;  
 
18
  g(x);                 // Ambiguous: g(T) or g(T&)
 
19
 
 
20
  A<int> z; 
 
21
  h(z);                 // overload resolution selects h(A<T>&)
 
22
 
 
23
  const A<int> z2;
 
24
  h(z2);                // h(const T&) is called because h(A<T>&) is not callable
 
25
 
 
26
  B<int,int> z3;
 
27
  l(z3);                // Ambiguous: l(B<T,int>) or l(B<T,T>)
 
28
}