Ne.app NeANT
The Ne.app NeANT User module of the NeANT distribution.
INSTANTIATE_DEFAULT_ARGS.cpp
Go to the documentation of this file.
1// checking if default args are instantiated
2
3
25#include "config.h"
26
27
28template <class T>
29struct A
30{
31 // must be able to use inaccessible members
32 void foo (const T& = T ()) { }
33
34 // must be able to use non-existent members
35 void bar (const T& = T::foobar ());
36};
37
38template <class T>
39void A<T>::bar (const T& /* = T::foobar () */) { }
40
41struct B
42{
43 // no foobar() declared
44private:
45 B () { }
46};
47
48#ifndef _RWSTD_NO_EXPLICIT_INSTANTIATION
49// 14.7.2, p9 - an explicit instantiation does not constitute
50// a use of a default argument
51template class A<B>;
52
53#else // if defined (_RWSTD_NO_EXPLICIT_INSTANTIATION)
54
55void foo ()
56{
58}
59
60#endif // _RWSTD_NO_EXPLICIT_INSTANTIATION
#define T
Definition 17.names.cpp:163
#define B
Definition 17.names.cpp:145
#define foo(buf, s,...)
void foo(const T &=T())