Errors, bugs, questions - page 1569

 
Ruslan Khasanov:
Why does "rubbish" appear when using a styler?
And why do you use it? ))
 

Compilation error (build 1327)

class A { 
public:
        bool operator++( int ) { return false; }
};

void OnStart()
{
        A a;
        while ( a++ ); //'++' - illegal operation use
}
 

Compilation error

class A { public:
template<typename T>        void f( T t );
template<typename T> static void g( T t );
}; 
template<typename T> void A::f( T t ) {}
template<typename T> void A::g( T t ) {}

void OnStart()
{
        A a;
        a.f(  1 ); //нормально
        A::g( 1 ); //'g<int>' - access to non-static member or function
}
 

Compilation error

class A { public:
        A *operator ++()      { return &this; }
};
template<typename T> void f( T t ) {}
void g( A *a )
{
        f( ++a ); //'A' - declaration without type (1)
        f( a.operator++()); //нормально            (2)
}
Special note - if you swap(!) lines (1) and (2) it's fine, which requires additional checking
 
A100:

Compilation error

I'd like to especially note that if you swap(!) lines (1) and (2), everything is fine, which requires additional checking
Do I understand correctly that f(++a) and f(a++) cause different variants of f in your example?
 
Anton Zverev:
Do I understand correctly that f(++a) and f(a++) cause different variants of f in your sample?

No, this is a compilation error - i.e. it hasn't come to execution (specific calls) yet. Strings (1) and (2) are equivalent from the code's viewpoint (different writing of the same thing)

Here is another sample so that I don't get an impression that it's only about the ++ operator

class A { public:
        A *operator <<( int )      { return &this; }
};
template<typename T> void f( T* t ) {}
void g( A* a )
{
        f( a << 1 ); //'A' - declaration without type
}
 
A100:

Lines (1) and (2) are equivalent in terms of code (different writing of the same thing)

++a and a++ are nevertheless different in meaning. Don't you think?
 
Anton Zverev:
++a and a++ are, after all, different in meaning. Don't you think?
there is no a++
 

Compilation error: tree optimization error

#property library

class A { public:
template<typename T> int f( T a, int b, bool c = false );
};
template<typename T>
int A::f( T a, int b, bool c ) { return 0; }

class B : public A {
        virtual void g();
};
void B::g()
{
        f( 0, 0, false ); //нормально
        f( 0, 0 );        //tree optimization error
}

class C {};
void start( C* ) export {}

As'tree optimization error' is not easy to localize, I ask developers (if they have such possibility) to put all optimization into optimization key (thank God it exists), otherwise even with disabled optimization working programs turn out to be fully disabled after build upgrade (and it is impossible to go back).

Note that all errors today are not old, but new - before ( build 1241) everything worked
 
A100:
there's no a++

Right. That's why I specified

Anton Zverev:
Do I understand correctly that f(++a) and f(a++) cause different variants of f in your example?
Reason: