-Wextra and unsigned template parameters
lopezibanez@gmail.com
lopezibanez@gmail.com
Wed May 10 16:30:00 GMT 2006
On 10/05/06, Joe Buck <Joe.Buck@synopsys.com> wrote:
> But then I just thought of another case:
>
> template <typename Container>
> struct foo {
> foo(const Container& bar) { if (bar.size() >= 0) use(bar); }
> };
>
> For any STL-compliant container the test is redundant. But if
> we put in a rule saying to suppress the warning if the type
> depends on a template, we lose the warning in this case as well;
> after all, nothing stops someone from writing
>
> class C {
> public:
> int size() const;
> ...
> };
>
> void use(const C&);
>
My STL may be a bit rusty...if you don't define size(), what is its
return type?. Also, there should be no warning in this example, am I
wrong?
More information about the Gcc
mailing list