Bug 41995 - Incorrect point of instantiation for function template
Summary: Incorrect point of instantiation for function template
Status: RESOLVED DUPLICATE of bug 29131
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.4.0
: P3 minor
Target Milestone: 4.7.0
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on: 16635
Blocks:
  Show dependency treegraph
 
Reported: 2009-11-09 11:19 UTC by Sebastian Mach
Modified: 2011-09-26 17:07 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2010-01-06 19:44:45


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sebastian Mach 2009-11-09 11:19:37 UTC
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
Comment 1 Jonathan Wakely 2009-11-09 12:01:00 UTC
probably related to PR 23885 and/or PR 16635
Comment 2 Richard Biener 2009-11-09 12:18:21 UTC
EDG accepts it in strict mode though I also think it's invalid.
Comment 3 Andrew Pinski 2009-11-09 16:00:57 UTC
Actually this is a combition of two issues really.  First is argument dependent lookup for fundamental types, do they have an assoicated namespaces (I think there is a bug report for that)?

And then the other bug is the wrong place: PR 16635.

Comment 5 Paolo Carlini 2011-09-25 16:49:22 UTC
Both 225 and 993 have been resolved, as NAD and FDIS, respectively. We should analyze which are the implication for this..
Comment 6 Jason Merrill 2011-09-26 17:07:22 UTC
Fixed by the patch for 29131.

*** This bug has been marked as a duplicate of bug 29131 ***