Supporting of template class level TM attributes

Supporting of template class level TM attributes

Does the class level TM attribute support template class? And how to mark it? I cannot find any example on the guide.

My code with annotated template class seems cannot get compiled.

Thanks very much.

4 Beiträge / 0 neu
Letzter Beitrag
Nähere Informationen zur Compiler-Optimierung finden Sie in unserem Optimierungshinweis.

Yes we support TM attribute on template class. Syntax is

__declspec(tm_callable)

template class A {

};

I'm using the Linux version and I cannot get my following code compiled:

//temp2.cpp
#include 
using namespace std;
__attribute__((tm_callable))
template
class A{
public:
T a;
T getA(){return a;}
};
int main()
{
A mya;
int x;
__tm_atomic{
x=mya.getA();
}
cout<}

The error message is:

temp2.cpp(7): error: "template" is not allowed
template
^
temp2.cpp(12): warning #12: parsing restarts here after previous syntax error
};
^
temp2.cpp(16): error: identifier "A" is undefined
A mya;
^
temp2.cpp(16): error: type name is not allowed
A mya;
^
temp2.cpp(16): error: identifier "mya" is undefined
A mya;
^
compilation aborted for temp2.cpp (code 2)

So what could be the problem? Thanks!

Unfortunatelywe don't support marking on class templates currently (just working on this).The correct syntax should be

template
class __declspec(tm_callable)A {
void foo(T t) { return t++; }
};
For Linux I believe __attribute__() should be written at the same position.

By now the only solution is placing __attribute__ on each method.

Kommentar hinterlassen

Bitte anmelden, um einen Kommentar hinzuzufügen. Sie sind noch nicht Mitglied? Jetzt teilnehmen