Sign in to follow this  

Errors produced by classes in namespaces accessing global properties

This topic is 1049 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Using AngelScript 2.30.0, I encountered these two today:

 

An unjustified compile time error when a method of a class in a namespace calls a function with an argument that defaults to a global variable:

int i;
void f(int a = i) {}
namespace n {
 class c {
  void m() {
   f();
  }
 }
}
script.as (5, 3) : INFO : Compiling void c::m()
default arg (1, 1) : ERR : 'i' is not declared
script.as (6, 4) : ERR : Failed while compiling default arg for parameter 0 in function 'void f(int = i)' 

An unjustified compile time error when a class in a namespace has a property that defaults to a global variable:

int i;
namespace n {
 class c {
  int p = i;
 }
}
script.as (3, 8) : INFO : Compiling c::c()
script.as (4, 11) : ERR : 'i' is not declared

The errors disappear if "::" is added in front of "i" in the appropriate places in the above examples but given the conditions it shouldn't be required (and, in the former case, may be impossible to add from script level if the function in question is registered by the application).

Edited by Sir Ementaler

Share this post


Link to post
Share on other sites

This topic is 1049 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this