This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/21413] New: bogus diagnostic from unidentified template


In:

#include <iterator>
template<typename T> void foo(int);
template<typename C> typename std::iterator_traits<C>::value_type foo(const C&);
int main() {
    int s;
    foo<float>(s);
    }


you get:

~/ootbc/members/src$ g++ foo.cc
/mnt/export/local/bin/../lib/gcc/i686-pc-linux-gnu/3.4.0/../../../../include/c++/3.4.0/bits/stl_iterator_base_types.h:
In instantiation of `std::iterator_traits<float>':
foo.cc:6:   instantiated from here
/mnt/export/local/bin/../lib/gcc/i686-pc-linux-gnu/3.4.0/../../../../include/c++/3.4.0/bits/stl_iterator_base_types.h:129:
error: `float' is not a class, struct, or union type
/mnt/export/local/bin/../lib/gcc/i686-pc-linux-gnu/3.4.0/../../../../include/c++/3.4.0/bits/stl_iterator_base_types.h:130:
error: `float' is not a class, struct, or union type
/mnt/export/local/bin/../lib/gcc/i686-pc-linux-gnu/3.4.0/../../../../include/c++/3.4.0/bits/stl_iterator_base_types.h:131:
error: `float' is not a class, struct, or union type
/mnt/export/local/bin/../lib/gcc/i686-pc-linux-gnu/3.4.0/../../../../include/c++/3.4.0/bits/stl_iterator_base_types.h:132:
error: `float' is not a class, struct, or union type
/mnt/export/local/bin/../lib/gcc/i686-pc-linux-gnu/3.4.0/../../../../include/c++/3.4.0/bits/stl_iterator_base_types.h:133:
error: `float' is not a class, struct, or union type


The call identifies the first overload, but you get a diagnostic from the second 
overload which is not identified. If you remove the iterator_traits reference
from the return type (just 'void' or some other innocuous type) then the first
overload identifies successfully without diagnostic.

Ivan

-- 
           Summary: bogus diagnostic from unidentified template
           Product: gcc
           Version: 3.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: igodard at pacbell dot net
                CC: gcc-bugs at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21413


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]