[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / SemaCXX / ms-const-member-expr.cpp
blob8312f84b550f00f867ade0148cdbc8596985394f
1 // RUN: %clang_cc1 %s -std=c++11 -fms-compatibility -fsyntax-only -verify
2 // RUN: %clang_cc1 %s -std=c++11 -fms-compatibility -fsyntax-only -verify -fexperimental-new-constant-interpreter
4 struct S {
5 enum { E = 1 };
6 static const int sdm = 1;
7 };
9 void f(S *s) {
10 char array[s->E] = { 0 };
13 extern S *s;
14 constexpr int e1 = s->E;
16 S *side_effect(); // expected-note{{declared here}}
17 constexpr int e2 = // expected-error{{must be initialized by a constant expression}}
18 side_effect()->E; // expected-note{{cannot be used in a constant expression}}
20 constexpr int e4 = s->sdm;