[LLVMdev] Clang bug?

Howard Hinnant hhinnant at apple.com
Fri Sep 28 18:45:30 PDT 2012


On Sep 28, 2012, at 5:54 PM, Richard Smith <richard at metafoo.co.uk> wrote:

> Reduced testcase:
> 
> template<typename T> struct A { typedef decltype(T() + 0) type; };
> template<typename T> struct B {
>   struct C { typedef typename A<C*>::type type; };
>   typedef typename A<C*>::type type;
> };
> B<int> b;
> 
> ... produces ...
> 
> <stdin>:3:38: error: no type named 'type' in 'A<B<int>::C *>'
>   struct C { typedef typename A<C*>::type type; };
>                      ~~~~~~~~~~~~~~~~^~~~
> <stdin>:1:54: note: in instantiation of member class 'B<int>::C' requested here
> template<typename T> struct A { typedef decltype(T() + 0) type; };
>                                                      ^
> <stdin>:4:20: note: in instantiation of template class 'A<B<int>::C *>' requested here
>   typedef typename A<C*>::type type;
>                    ^
> <stdin>:6:8: note: in instantiation of template class 'B<int>' requested here
> B<int> b;
>        ^
> 
> I think it would be worth filing this as a diagnostic QoR issue. We should be able to say something like
> 
> <stdin>:3:38: error: member 'type' of 'A<B<int>::C *>' required recursively within the instantiation of 'A<B<int>::C *>', but it has not been instantiated yet

Hi Richard,

Is your position that tot clang/libc++ is in error for not producing a diagnostic?

Howard




More information about the llvm-dev mailing list