[cfe-dev] Clang fails to diagnose static_cast<> issue in member function of class template

Dmitri Gribenko gribozavr at gmail.com
Wed Oct 30 18:33:53 PDT 2013


On Wed, Oct 30, 2013 at 6:16 PM, Mark Lacey <mark.lacey at apple.com> wrote:
> My commit earlier broke the VC++ build, and I’ve reduced the code to the following (at the bottom).
>
> I’m not sure if this is something Clang should diagnose, something VC++ shouldn’t diagnose, or if both behaviors are considered correct.
>
> Clang only emits a diagnostic if there is a function body that declares a value of Derived<Other> - it doesn’t emit a diagnostic for member variables of type Derived<Other>. Should it eagerly diagnose this?

As far as I understand, [temp.inst]/11 applies here:

[...] It is unspecified whether or not an implementation implicitly
instantiates a virtual member function of a class template if the
virtual member function would not otherwise be instantiated. [...]

Dmitri

-- 
main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
(j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/




More information about the cfe-dev mailing list