Topic: deducing local types


Author: scott douglass <sdouglass%_%junk@_.arm.com>
Date: 1999/05/20
Raw View
Hello,

I was trying to convince myself that the following is legal:

void g(void*);
template <class T> void g(T*) { }
void f() {
  struct S {  } s;
  g(&s);  // calls '::g'
}

But I couldn't find any prohibition in 14.8.2 about deducing local types.  If
you deduce 'T' to 'S*' then the template argument is illegal by 14.3.1 ('S' is a
type with no linkage).

I wish 14.8.2 said that type deduction could fail because the deduced type was
local.

Is there anything I'm missing?


[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]