1

Could anyone help me find out what is wrong with in-class initialization of static constexpr member varaible like in the code below ?

Using Visual Studio 2013

struct hg {
public:
    static constexpr float asd = 9.0f;
};

int main() {
    return 0;
}

The above code gives the following errors :

Error 1

error C2144: syntax error : 'float' should be preceded by ';'

Error 2

error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
anksh
  • 35
  • 7
  • `constexpr` not available in [`vs2013`](https://stackoverflow.com/questions/20264644/constexpr-not-compiling-in-vc2013) – Praveen May 23 '17 at 06:13
  • Ok. Is the only workaround this : static const float asd() {return 9.0f;} – anksh May 24 '17 at 06:05

0 Answers0