How do I fix "invalid type argument of 'unary*'?
<p>Okay, so i'm reposting this but also including an update, Probably against the rules, but I couldn't find any other way to do so. Someone asked for a description on my class and I couldn't figure out how to add it, so if someone can help me figure out how to edit my post that would also be greatly appreciated. 
So I've been running into an error "Invalid type argument of 'unary*' while using this code </p>

<pre><code>static int cmp_bk( const void *ap, const void *bp)
{
    int a; 
    int b;
    dynamic_cast&lt;const struct bk&gt;(*a)=ap;
    dynamic_cast&lt;const struct bk&gt;(*b)=bp;

    if (a-&gt;hash &lt; b-&gt;hash) return -1;
    if (a-&gt;hash &gt; b-&gt;hash) return 1;
    return (int)a-&gt;bk - (int)b-&gt;bk;
}
</code></pre>

<p>The exact error I get is:</p>

<p>invalid type argument of 'unary *'</p>

<p>and it's set to both the lines</p>

<pre><code>dynamic_cast&lt;const struct bk&gt;(*a)=ap;
dynamic_cast&lt;const struct bk&gt;(*b)=bp;
</code></pre>

<p>so someone told me to rewrite it using a reinterpret_cast instead of a dynamic, but kept getting "undelcared" variables, so I just starting making things up to get something to work so I know it's wrong and this is my current result with the new errors "expected primary-expression before '->' token" for all the '->' tokens.</p>

<pre><code>static int cmp_bk( const void *ap, const void *bp)
{
   class bk {};
   class pa {};
   class pb {};
   class a {};
   class b {};
   bk * pa;
   bk * pb;
    ap = reinterpret_cast&lt;bk*&gt;(pa);
    bp = reinterpret_cast&lt;bk*&gt;(pb);

    if (a -&gt; hash &lt; b -&gt; hash) return -1;
    if (a-&gt;hash &gt; b-&gt;hash) return 1;
    return (int)a-&gt;bk -int)b-&gt;bk;
}
</code></pre>

<p>also my bk class is within a static union so here is all of it. </p>

<pre><code> /* Transposition table and opening book share the same memory */
 static union {
 #define TTABLE (core.tt) 
    struct tt {                     /* Transposition table entry */
            unsigned short hash;    /* - Identifies position */ 
            short move;             /* - Best recorded move */
            short score;            /* - Score */
            char flag;              /* - How to interpret score */
            char depth;             /* - Remaining search depth */
    } tt[CORE];
 #define BOOK (core.bk)       
    struct bk {                     /* Opening book entry */
            unsigned long hash;     /* - Identifies position */
            short move;             /* - Move for this position */
            unsigned short count;   /* - Frequency */
    } bk[CORE];
} core;

//#define TTABLE (core.tt)
//#define BOOK (core.bk)
</code></pre>

<p>hopefully this is all the information people need, as I said if someone can also help me to edit my post so I don't have to make a new one that would be greatly appreciated. and thanks for everyone's help that helped on the last post and come to help on this new post.</p>
