[cfe-dev] -Wmismatched-tags in MacOSX's valarray

Axel Naumann Axel.Naumann at cern.ch
Thu Oct 21 04:53:43 PDT 2010


Hi,

Christopher Jefferson wrote on 10/21/2010 01:06 PM:
> Note that the 'friend' declaration uses 'class', while the definition of _Array uses 'struct'.

Thanks for spotting it! Would clang have a chance to also put that
location into the warning, instead of only the (in this case irrelevant)
location of the instantiation?

> It would be nice to suppress all warnings from system headers.

I agree! :-) It would be nice to have an option for it, like -wsystem.

Cheers, Axel.

> 
> On 21 Oct 2010, at 10:09, Axel Naumann wrote:
> 
>> Hi,
>>
>> compiling code that #includes <valarray> on MacOS X 10.6 triggers this:
>>
>> warning: class  '_Array' was previously declared as a struct
>> [-Wmismatched-tags]
>> In file included from cint/cint/lib/dll_stl/G__cpp_valarray.cxx:7:
>> In file included from ./cint/cint/lib/dll_stl/G__cpp_valarray.h:32:
>> In file included from ./cint/cint/lib/dll_stl/vary.h:10:
>> In file included from /usr/include/c++/4.2.1/valarray:539:
>> /usr/include/c++/4.2.1/bits/valarray_after.h:62:24: note: in
>> instantiation of template class 'std::valarray<unsigned long>' requested
>> here
>>      { return _M_index.size(); }
>>                       ^
>> In file included from cint/cint/lib/dll_stl/G__cpp_valarray.cxx:7:
>> In file included from ./cint/cint/lib/dll_stl/G__cpp_valarray.h:32:
>> In file included from ./cint/cint/lib/dll_stl/vary.h:10:
>> In file included from /usr/include/c++/4.2.1/valarray:91:
>> /usr/include/c++/4.2.1/bits/valarray_array.h:414:12: note: previous use
>> is here
>>    struct _Array
>>           ^
>> Is this warning correct? If so: can you get your colleagues down the
>> hallway to fix it? ;-)
> 
> The problem is that 'struct _Array' is used in valarray_array.h, while 
>>
>> And probably it's just me, but I have a hard time understanding the
>> warning message itself: is it claiming that structs cannot be templated?
>> Where is the "class _Array" that mismatches the "struct _Array"?
>>
>> Cheers, Axel.
>> _______________________________________________
>> cfe-dev mailing list
>> cfe-dev at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
> 
> 



More information about the cfe-dev mailing list