Indirect call not allowed

Indirect call not allowed

Hi,

When trying to compile a code like this:

Class1::getInstance()->getClass2()->method1();

The compiler says: error: indirect call is not allowed inside routine.

Whereas if a variable is used to hold the results of the first function call:

Class2 class2 = Class1::getInstance()->getClass2();
class2->method1();

The compiler will not give any error. Why does the compiler work this way? Is there any way of overriding this behavior?

Thanks a lot, and greetings,

Javier

2 posts / novo 0
Último post
Para obter mais informações sobre otimizações de compiladores, consulte Aviso sobre otimizações.

Need to see code for Class1 and Class2. Working with author in a private mail

Faça login para deixar um comentário.