[cfe-commits] r120063 - in /cfe/trunk: lib/Sema/SemaDeclCXX.cpp test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p8.cpp

Douglas Gregor dgregor at apple.com
Mon Nov 29 09:25:45 PST 2010


On Nov 23, 2010, at 2:03 PM, John McCall wrote:

> Author: rjmccall
> Date: Tue Nov 23 16:03:51 2010
> New Revision: 120063
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=120063&view=rev
> Log:
> Redeclarations of using declarations are not okay in function scopes.
> Not sure what I was thinking before.
> 
> Fixes PR8668.

This reverses a previous commit:

------------------------------------------------------------------------
r103210 | dgregor | 2010-05-06 16:31:27 -0700 (Thu, 06 May 2010) | 3 lines

It turns out that we should be allowing redeclarations within function
scope. Thanks to Steven Watanabe for correcting me.

PR8668 is actually invalid (not a Clang bug), because redeclarations *are* okay within block scopes. For example, this is well-formed:

void g() {
  void f(int);
  void f(int);
  extern int j;
  extern int j;
}

Obviously,

  void h() {
	int k;
	int k;
  }

is ill-formed, but that's not because it's a redeclaration of 'k': it's because both declarations are also definitions.

	- Doug



More information about the cfe-commits mailing list