[patch] Fix pr16247

Eli Friedman eli.friedman at gmail.com
Tue Jun 18 06:16:32 PDT 2013


On Tue, Jun 18, 2013 at 5:47 AM, Rafael EspĂ­ndola <
rafael.espindola at gmail.com> wrote:

> > I also badgered the committee back in February when this last came up,
> > and no consensus for a language change appeared. I'm trying
> > rebadgering :)
>
> Until then I think we should conform to what other compilers do and is
> less surprising to the users. This is not the same case as, for
> example, dependent bases, where the standard was not implemented by
> gcc and msvc at the time but was a better model than what those
> compilers implemented. Examples like:
>
> extern "C" {
>   static void foo(int x);
>   static void foo() {
>   }
>   void foo(int x) {
>   }
> }
>
> show are not adding value by being pedantically correct.
>
> I am not sure I understand your suggestion about
> LocallyScopedExternCDecls. Consider a variant of the testcase above
> with just the last two functions. The foo(int) will be the fist extern
> C and overload resolution will decide we have an overload. We would
> have to walk the lookup results again to find foo().
>

Suppose overloading completely ignores whether a declaration is extern "C",
and suppose you have a hashtable which returns the extern "C" decl for a
given identifier.  After you conclude foo(int) overloads foo(), you look in
the hashtable and say "oops, there was already a declaration with that
name".  (I haven't really thought through whether this is a good idea.)

-Eli
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130618/ef46c574/attachment.html>


More information about the cfe-commits mailing list