🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Namespace can not be omitted when passing enum with constructor argument

Started by
1 comment, last by WitchLord 6 years, 1 month ago

namespace test
{
    enum ETest { A, B }
    
    class CTest {
        CTest(const ETest v = ETest::A) {}
    }
}

void main()
{
  test::CTest a;
}

Prepare the above code and execute it.


> asrun.exe script2.as
script2.as (15, 1) : INFO : Compiling void main()
default arg (1, 1) : ERR  : Unknown scope 'ETest'
script2.as (17, 15) : ERR  : Failed while compiling default arg for parameter 0 in function 'test::CTest@ CTest(const test::ETest = ETest :: A)'

Abnormally ends after outputting the above.

Describing the namespace as below will compile successfully.


CTest(const ETest v = test::ETest::A) {}

 

Advertisement

Thanks. I'll look into this and make necessary improvements.

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

This topic is closed to new replies.

Advertisement