p9.cpp 841 B

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