C++ Compilers & ISO Conformance 
by Brian A. Malloy, James F. Power, and Tanton H. Gibbs

Listing One
1 class A {
2    public :
3    static int n;
4 };
5 int main() {
6 int A;
7 A::n = 42; // OK
8 A b;  // ill-formed: A does not name a type
9 }


Listing Two

1  template < class T >
2  class complex {
3  public :
4     complex(T x) : r(x) {}
5     complex(T x, T y) : r(x), i(y) {}
6 private :
7     T r, i;
8 } ;


Listing Three

1 class T { /* ... */ }
2 int i;
3 template < class T, T i > void f(T t) {
4    T t1 = i; // template-parameters T and i
5    ::T t2 = ::i; // global namespace members T and i
6 }


Listing Four

1 class T {
2 public :
3   T(int n) : number(n) {}
4 private :
5   int number;
6 {
7 int i;
8 template < class T, T i > void f(T t) {
9    T t1 = i; // template-parameters T and i
10   ::T t2 = ::i; // global namespace members T and i
11 }
12 int main() f{
13    f <float , 1.0 > (2.5);
14 }


Listing Five

1 typedef int f;
2 struct A {
3   friend void f(A &);
4   operator int ();
5   void g(A a) {
6      f(a);
7   }
8 };


Listing Six

1 class CppTestCase(unittest.TestCase) :
2    def init (self, testfun, fname):
3       unittest.TestCase.__init__(self, testfun)
4       self.compile = [
5 "g++ -Wall -ansi -pedantic-errors -c %s.cpp",
6          "cl /Za /W4 /c %s.cpp",
7          "bcc32 -A -RT -q -w -x -c %s.cpp",
8          "eccp --strict -c %s.cpp",
9          "pgCC -w -Xa -c %s.cpp",
10         "como -c %s.cpp",
11         "icc -ansi -Wall -c %s.cpp",
12         "wcl386 -za -zq -xr -xs -wx -c %s.cpp"
13 ]
14     self.link = [
15         "g++ -o %s.exe %s.o",
16         "cl /nologo /w /Fe %s.exe %s.obj",
17         "bcc32 -q -e %s.exe %s.obj",
18         "eccp --strict -o %s.exe %s.cpp",
19         "pgCC -o %s.exe %s.o",
20         "como -o %s.exe %s.o",
21         "icc -o %s.exe %s.o",
22         "cl /w /Fe %s.exe %s.obj"
23         ]
24    self.fileName = fname
25    self.toPass = not (fname[:4] == "fail")
26    self.hasMain = 0
27    self.directory = os.getcwd()


Listing Seven

1 static void f();
2 static int I=0;
3 void g() {
4   extern void f();  //internal linkage
5   int I; // 2: 'I' has not linkage
6   {
7      extern void f(); // internal linkage
8      extern int I;    // 3: external linkage
9   }
10 }


Listing Eight

1 // Changed wrt TC1 (issue #24)
2 template < class T1 > class A {
3    template < class T2 > class B {
4    public :
5       void mf();
6    };
7 };
8 template <> template <>
9 class A < int > ::B < double >;





