1

The following trivial code does not compile with GCC 4.9 and MSVC 2015:

struct A
{
    static constexpr size_t GetTextureCount()
    {
        return 5;
    }

    static constexpr size_t a = GetTextureCount();
};

GCC 4.9 error: 'static constexpr size_t ISparkleRenderer::GetTextureCount()' called in a constant expression

MSVC 2015 error C2131: expression did not evaluate to a constant

Why this code does not compile? Probably I need higher compiler versions?

1
  • 1
    For anyone curious, more modern versions of gcc give out better error message. Commented Sep 16, 2017 at 20:40

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.