xref: /llvm-project/clang/test/CXX/temp/temp.param/p9.cpp (revision 205d0445529eb985a1485ff8e2a18908f75f3bb1)
18fbe78f6SDaniel Dunbar // RUN: %clang_cc1 -fsyntax-only -std=c++98 -verify %s
2ed5731f6SDouglas Gregor 
3ed5731f6SDouglas Gregor // A default template-argument shall not be specified in a function
4ed5731f6SDouglas Gregor // template declaration or a function template definition
5*205d0445SDouglas Gregor template<typename T = int> // expected-warning{{default template arguments for a function template are a C++11 extension}}
6ed5731f6SDouglas Gregor   void foo0(T);
7*205d0445SDouglas Gregor template<typename T = int> // expected-warning{{default template arguments for a function template are a C++11 extension}}
foo1(T)8ed5731f6SDouglas Gregor   void foo1(T) { }
9ed5731f6SDouglas Gregor 
10ed5731f6SDouglas Gregor // [...] nor in the template-parameter-list of the definition of a
11ed5731f6SDouglas Gregor // member of a class template.
12ed5731f6SDouglas Gregor template<int N>
13ed5731f6SDouglas Gregor struct X0 {
14ed5731f6SDouglas Gregor   void f();
15ed5731f6SDouglas Gregor };
16ed5731f6SDouglas Gregor 
17ed5731f6SDouglas Gregor template<int N = 0> // expected-error{{cannot add a default template argument}}
f()18ed5731f6SDouglas Gregor void X0<N>::f() { }
19ed5731f6SDouglas Gregor 
20ed5731f6SDouglas Gregor class X1 {
21ed5731f6SDouglas Gregor   template<template<int> class TT = X0> // expected-error{{not permitted on a friend template}}
22ed5731f6SDouglas Gregor   friend void f2();
23ed5731f6SDouglas Gregor };
24