xref: /openbsd-src/gnu/usr.bin/gcc/gcc/testsuite/g++.old-deja/g++.oliva/template4.C (revision c87b03e512fc05ed6e0222f6fb0ae86264b1d05b)
1 // Build don't link:
2 
3 // Copyright (C) 1999 Free Software Foundation
4 
5 // by Alexandre Oliva <oliva@dcc.unicamp.br>
6 // based on bug report by Andrey Slepuhin <pooh@msu.ru>
7 
8 template <const int&> struct X {};
9 
10 int a = 1;
11 X<a> x; // ok, a has external linkage
12 
13 const int b = 2;
14 X<b> y; // ERROR - const b has internal linkage
15 
16 extern const int c;
17 X<c> z; // ok, c has external linkage
18 
19 extern const int c = 3;
20 X<c> z_; // gets bogus error - using c as constant
21