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