1 // PR c++/51141
2 // { dg-do compile }
3 // { dg-options "-fpermissive -w -Werror" }
4 
5 typedef int size_t;
6 template < size_t, size_t > struct AlignedBuffer {};
7 
8 template < typename > class VectorBufferBase
9 {
10 public:
allocateBuffer(size_t)11     allocateBuffer (size_t) {
12     }
buffer()13     buffer () {
14     }
15     *m_buffer;
16     size_t m_capacity;
17 };
18 
19 template < typename T, size_t > class VectorBuffer:VectorBufferBase < T >
20 {
21     typedef VectorBufferBase < T > Base;
22 
23 public:
VectorBuffer()24     VectorBuffer () {
25     }
allocateBuffer(size_t)26     allocateBuffer (size_t) {
27         m_capacity = 0;
28     }
29     Base::buffer;
30     Base::m_buffer;
31     Base::m_capacity;
32     size_t m_inlineBufferSize;
33 
34     AlignedBuffer < 0, __alignof__ (T) > m_inlineBuffer;
35 };
36 
37 template < typename T, size_t > class Vector
38 {
39     typedef VectorBuffer < T,
40             0 > Buffer;
41 public:
42     void shrinkCapacity (size_t);
43 
clear()44     clear () {
45         shrinkCapacity (0);
46     }
47     Buffer m_buffer;
48 };
49 
50 template < typename T, size_t inlineCapacity > void Vector < T,
shrinkCapacity(size_t)51          inlineCapacity >::shrinkCapacity (size_t)
52 {
53     m_buffer.allocateBuffer (0);
54 }
55 
56 struct PatternDisjunction;
57 struct YarrPattern {
resetYarrPattern58     reset () {
59         m_disjunctions.clear ();
60     }
61     Vector < PatternDisjunction *, 0 > m_disjunctions;
62 };
63