xref: /minix3/external/bsd/llvm/dist/clang/test/SemaCXX/local-classes.cpp (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -fsyntax-only -verify %s
2*f4a2713aSLionel Sambuc // expected-no-diagnostics
3*f4a2713aSLionel Sambuc 
4*f4a2713aSLionel Sambuc namespace PR6382 {
foo()5*f4a2713aSLionel Sambuc   int foo()
6*f4a2713aSLionel Sambuc   {
7*f4a2713aSLionel Sambuc     goto error;
8*f4a2713aSLionel Sambuc     {
9*f4a2713aSLionel Sambuc       struct BitPacker {
10*f4a2713aSLionel Sambuc         BitPacker() {}
11*f4a2713aSLionel Sambuc       };
12*f4a2713aSLionel Sambuc       BitPacker packer;
13*f4a2713aSLionel Sambuc     }
14*f4a2713aSLionel Sambuc 
15*f4a2713aSLionel Sambuc   error:
16*f4a2713aSLionel Sambuc     return -1;
17*f4a2713aSLionel Sambuc   }
18*f4a2713aSLionel Sambuc }
19*f4a2713aSLionel Sambuc 
20*f4a2713aSLionel Sambuc namespace PR6383 {
test(bool gross)21*f4a2713aSLionel Sambuc   void test (bool gross)
22*f4a2713aSLionel Sambuc   {
23*f4a2713aSLionel Sambuc     struct compare_and_set
24*f4a2713aSLionel Sambuc     {
25*f4a2713aSLionel Sambuc       void operator() (const bool inner, const bool gross = false)
26*f4a2713aSLionel Sambuc       {
27*f4a2713aSLionel Sambuc         // the code
28*f4a2713aSLionel Sambuc       }
29*f4a2713aSLionel Sambuc     } compare_and_set2;
30*f4a2713aSLionel Sambuc 
31*f4a2713aSLionel Sambuc     compare_and_set2 (false, gross);
32*f4a2713aSLionel Sambuc   }
33*f4a2713aSLionel Sambuc }
34*f4a2713aSLionel Sambuc 
35*f4a2713aSLionel Sambuc namespace Templates {
36*f4a2713aSLionel Sambuc   template<int Value>
f()37*f4a2713aSLionel Sambuc   void f() {
38*f4a2713aSLionel Sambuc     struct Inner {
39*f4a2713aSLionel Sambuc       static int getValue() { return Value; }
40*f4a2713aSLionel Sambuc     };
41*f4a2713aSLionel Sambuc   }
42*f4a2713aSLionel Sambuc }
43