• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // RUN: %clang_cc1 -fsyntax-only -std=c++98 -verify %s
2 
3 // A default template-argument shall not be specified in a function
4 // template declaration or a function template definition
5 template<typename T = int> // expected-warning{{default template arguments for a function template are a C++11 extension}}
6   void foo0(T);
7 template<typename T = int> // expected-warning{{default template arguments for a function template are a C++11 extension}}
foo1(T)8   void foo1(T) { }
9 
10 // [...] nor in the template-parameter-list of the definition of a
11 // member of a class template.
12 template<int N>
13 struct X0 {
14   void f();
15 };
16 
17 template<int N = 0> // expected-error{{cannot add a default template argument}}
f()18 void X0<N>::f() { }
19 
20 class X1 {
21   template<template<int> class TT = X0> // expected-error{{not permitted on a friend template}}
22   friend void f2();
23 };
24