Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.std.c++ > #486

Re: ADL: should this compile?

From Daniel Krügler<daniel.kruegler@googlemail.com>
Newsgroups comp.std.c++
Subject Re: ADL: should this compile?
Date 2012-04-22 13:52 -0700
Organization A noiseless patient Spider
Message-ID <jn1knp$hli$1@dont-email.me> (permalink)
References <9691852.1431.1335051276088.JavaMail.geo-discussion-forums@vbez20>

Show all headers | View raw


Am 22.04.2012 20:52, schrieb Jason McKesson:
[..]
>  Should this C++ code compile? I think ADL requires it to, but I'm not certain.
>
>  template<class T>
>  int t(T i)
>  {
>    return f(i);
>  }
>
>  struct a{};
>
>  int f(a i)
>  {
>    return 0;
>  }
>
>  int main()
>  {
>    a b;
>    return t(b);
>  }

Yes, this clearly is supposed to work according to ADL rules. All recent
compilers I know of (including gcc 4.8) accept this example as they should.

HTH&  Greetings from Bremen,

Daniel Krügler


-- 
[ comp.std.c++ is moderated.  To submit articles, try posting with your ]
[ newsreader.  If that fails, use mailto:std-cpp-submit@vandevoorde.com ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html                      ]

Back to comp.std.c++ | Previous | NextPrevious in thread | Find similar


Thread

ADL: should this compile? Jason McKesson <jmckesson@gmail.com> - 2012-04-22 11:52 -0700
  Re: ADL: should this compile? Daniel Krügler<daniel.kruegler@googlemail.com> - 2012-04-22 13:52 -0700

csiph-web