[cfe-commits] r165769 - /cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h

Sean Silva silvas at purdue.edu
Fri Oct 12 09:52:07 PDT 2012


>> Could this be made workable if we know that the classof() has the signature
>>     static bool classof(const T *);
>> where T is strictly is_base_of the enclosing class?
>
> The trick does not work for static methods. Can you use non-static ones?

Oh shoot. The method is static, unfortunately.

Richard, this invalidates the method you suggested to me over IRC, right?

-- Sean Silva

On Fri, Oct 12, 2012 at 3:31 AM, Abramo Bagnara
<abramo.bagnara at bugseng.com> wrote:
> Il 12/10/2012 04:31, Sean Silva ha scritto:
>>> Stupid attempt:
>>>
>>> struct A { void f(); };
>>> struct B : A {
>>> #ifdef B_HAS_F
>>>   void f();
>>> #endif
>>> };
>>> decltype(&B::f) x;
>>> extern void (B::*x)(); // error unless B_HAS_F
>>>
>>> Unfortunately, not a complete solution, because you don't know the
>>> precise signature of the classof you're looking for.
>>
>> Thanks! (there's a typedef needed before the decltype, right?)
>>
>> Could this be made workable if we know that the classof() has the signature
>>     static bool classof(const T *);
>> where T is strictly is_base_of the enclosing class?
>
> The trick does not work for static methods. Can you use non-static ones?
>
>> Also, is it possible to do without the decltype?
>
> You can use
>
> template <typename T, T x>
> struct has_type;
>
> to check if B::f is indeed a void (B::*)()
>
> --
> Abramo Bagnara
>
> BUGSENG srl - http://bugseng.com
> mailto:abramo.bagnara at bugseng.com



More information about the cfe-commits mailing list