class A { public:
template<typename T> void f( T t );
template<typename T> staticvoid g( T t );
};
template<typename T> void A::f( T t ) {}
template<typename T> void A::g( T t ) {}
voidOnStart()
{
A a;
a.f( 1 ); //нормально
A::g( 1 ); //'g<int>' - access to non-static member or function
}
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
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
}
#property libraryclass 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 ) { return0; }
class B : public A {
virtualvoid 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
Why does "rubbish" appear when using a styler?
Compilation error (build 1327)
Compilation error
Compilation error
Special note - if you swap(!) lines (1) and (2) it's fine, which requires additional checkingCompilation error
I'd like to especially note that if you swap(!) lines (1) and (2), everything is fine, which requires additional checkingDo 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
Lines (1) and (2) are equivalent in terms of code (different writing of the same thing)
++a and a++ are, after all, different in meaning. Don't you think?
Compilation error: tree optimization error
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 workedthere's no a++
Right. That's why I specified
Do I understand correctly that f(++a) and f(a++) cause different variants of f in your example?