Advertisement

Namespace can not be omitted when passing enum with constructor argument

Started by May 08, 2018 11:14 AM
1 comment, last by WitchLord 6 years, 6 months 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) {}

 

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