xref: /minix3/external/bsd/llvm/dist/clang/test/SemaCXX/invalid-instantiated-field-decl.cpp (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -fsyntax-only -verify %s
2*f4a2713aSLionel Sambuc 
3*f4a2713aSLionel Sambuc template <typename T>
4*f4a2713aSLionel Sambuc class SmallVectorImpl  {
5*f4a2713aSLionel Sambuc public:
SmallVectorImpl(unsigned N)6*f4a2713aSLionel Sambuc   explicit SmallVectorImpl(unsigned N) {
7*f4a2713aSLionel Sambuc   }
8*f4a2713aSLionel Sambuc 
~SmallVectorImpl()9*f4a2713aSLionel Sambuc   ~SmallVectorImpl() { }
10*f4a2713aSLionel Sambuc 
11*f4a2713aSLionel Sambuc };
12*f4a2713aSLionel Sambuc 
13*f4a2713aSLionel Sambuc template <typename T, unsigned N>
14*f4a2713aSLionel Sambuc class SmallVector : public SmallVectorImpl<T> {
15*f4a2713aSLionel Sambuc   typedef typename SmallVectorImpl<T>::U U; // expected-error {{no type named 'U' in 'SmallVectorImpl<CallSite>'}}
16*f4a2713aSLionel Sambuc   enum {
17*f4a2713aSLionel Sambuc 
18*f4a2713aSLionel Sambuc     MinUs = (static_cast<unsigned int>(sizeof(T))*N +	// expected-error {{invalid application of 'sizeof' to an incomplete type 'CallSite'}}
19*f4a2713aSLionel Sambuc              static_cast<unsigned int>(sizeof(U)) - 1) /
20*f4a2713aSLionel Sambuc             static_cast<unsigned int>(sizeof(U)),
21*f4a2713aSLionel Sambuc     NumInlineEltsElts = MinUs
22*f4a2713aSLionel Sambuc   };
23*f4a2713aSLionel Sambuc   U InlineElts[NumInlineEltsElts];
24*f4a2713aSLionel Sambuc public:
SmallVector()25*f4a2713aSLionel Sambuc   SmallVector() : SmallVectorImpl<T>(NumInlineEltsElts) {
26*f4a2713aSLionel Sambuc   }
27*f4a2713aSLionel Sambuc 
28*f4a2713aSLionel Sambuc };
29*f4a2713aSLionel Sambuc 
30*f4a2713aSLionel Sambuc class CallSite;	// expected-note {{forward declaration of 'CallSite'}}
31*f4a2713aSLionel Sambuc class InlineFunctionInfo {
32*f4a2713aSLionel Sambuc public:
InlineFunctionInfo()33*f4a2713aSLionel Sambuc   explicit InlineFunctionInfo() {}
34*f4a2713aSLionel Sambuc   SmallVector<CallSite, 2> DevirtualizedCalls;	// expected-note {{in instantiation of template class 'SmallVector<CallSite, 2>' requested}}
35*f4a2713aSLionel Sambuc };
36