I know this is nitpicky, but I haven't found references to it (or the whys) in
the database.

I am not a lawyer, but I think that according to [0][1], the following program
should not compile:


#include <iostream>

template <typename T>
void f (T t) {
    g (t);
}

int main () {
    f<int> (42);
} // point of instantiation of f<int>(), g(int) not yet visible

void g (int i) {
        std::cout << i << '\n';
}


To my best knowlege, if function g would take a non-intrinsic type, this would
be correct, but with raw int, ADL should not take place, i.e. the call to
g(int) in f<int>(int) refers to an unresolved symbol.


[0] Vandevoorde/Josuttis 10.3.2: Points of Instantiation
(http://books.google.de/books?id=EotSAwuBkJoC&pg=PA146&lpg=PA146&dq=vandevoorde+point+of+instantiation&source=bl&ots=iwJ0D7_jhd&sig=1yVPrdPe2Dx1AtoPFDpAkFKIe2Y&hl=de&ei=0WedSYORD42K0AXf24DgBQ&sa=X&oi=book_result&resnum=1&ct=result#PPA147,M1)
[1] ISO/IEC 14882:2003(draft) 14.6.4.1 Point of instantiation, Item 1


-- 
           Summary: Incorrect point of instantiation for function template
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: phresnel at gmail dot com


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

Reply via email to