xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGenCXX/static-mutable.cpp (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 %s -triple=i686-linux-gnu -emit-llvm -o - | FileCheck %s
2*f4a2713aSLionel Sambuc 
3*f4a2713aSLionel Sambuc struct S {
4*f4a2713aSLionel Sambuc   mutable int n;
5*f4a2713aSLionel Sambuc };
f()6*f4a2713aSLionel Sambuc int f() {
7*f4a2713aSLionel Sambuc   // The purpose of this test is to ensure that this variable is a global
8*f4a2713aSLionel Sambuc   // not a constant.
9*f4a2713aSLionel Sambuc   // CHECK: @_ZZ1fvE1s = internal global {{.*}} { i32 12 }
10*f4a2713aSLionel Sambuc   static const S s = { 12 };
11*f4a2713aSLionel Sambuc   return ++s.n;
12*f4a2713aSLionel Sambuc }
13