Skip to content

Commit

Permalink
CEA: added testfile illustrating problems with static member vars
Browse files Browse the repository at this point in the history
  • Loading branch information
hartogss committed Feb 18, 2021
1 parent de68813 commit ff082a9
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions test/unit/constexpr/StaticMemberVar.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// RUN: rm %t1.ast.json || true
// RUN: clang++ %s -emit-ast -o %t1.ast
// RUN: %S/../../../build/cxx-langstat --analyses=cea -emit-features -in %t1.ast -out %t1.ast.json --
// RUN: diff %t1.ast.json %s.json

// Should report one variable that is constexpr, namely "yes".
//
//

int main(int argc, char** argv){

}

struct C {
// Not reported, as not initialized.
static int no;
// Reported as not constexpr (good), but twice: once here, and once below
// at the definition. Do we want this?
static int no2;
// Not reported, as not init'ed.
static const int no3;
// Corectly reported as constexpr
static constexpr int yes = 1;
};

int C::no2 = 2;

0 comments on commit ff082a9

Please sign in to comment.