[Kde-pim] Akonadi item.h + clang
Patrick Ohly
patrick.ohly at gmx.de
Wed Apr 13 09:21:52 BST 2011
Hello!
I'm currently compiling Dinesh's SyncEvolution Akonadi backend. I'm
using clang++ 2.9 instead of g++ and noticed that the following trick in
item.h doesn't work with clang++:
template <typename T>
void Item::setPayload( T* p )
{
p.You_MUST_NOT_use_a_pointer_as_payload;
}
The reason is that clang++, in contrast to g++, already does error
checking on the template while compiling the template, not when it is
instantiated.
Therefore I get a compiler error about the member access in a pointer.
This patch fixes the issue while still triggering a compiler error when
Item::setPayload is used incorrectly:
*** item.h.orig 2011-04-13 10:12:23.000000000 +0200
--- item.h 2011-04-13 10:18:45.000000000 +0200
***************
*** 426,432 ****
template <typename T>
void Item::setPayload( T* p )
{
! p.You_MUST_NOT_use_a_pointer_as_payload;
}
template <typename T>
--- 426,432 ----
template <typename T>
void Item::setPayload( T* p )
{
! p->You_MUST_NOT_use_a_pointer_as_payload();
}
template <typename T>
--
Bye, Patrick Ohly
--
Patrick.Ohly at gmx.de
http://www.estamos.de/
_______________________________________________
KDE PIM mailing list kde-pim at kde.org
https://mail.kde.org/mailman/listinfo/kde-pim
KDE PIM home page at http://pim.kde.org/
More information about the kde-pim
mailing list