llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

Wrong parsing of record decls in parameters' lists

Open llvmbot opened this issue 16 years ago • 6 comments

Bugzilla Link 6298
Resolution FIXED
Resolved on Feb 28, 2012 12:38
Version trunk
OS Linux
Reporter LLVM Bugzilla Contributor
CC @jmolloy,@rjmccall

Extended Description

The following testcase shows that clang erroneously "believes" that the scope of record declarations in parameters' lists extends beyond the block scope and not inside the block, as the standard mandates.

$ cat bug.c

struct s { int x; };

void f(struct s { int y; }* v) { }

void g(struct t { int x; } v) { struct t { int y; }; } $ clang bug.c bug.c:4:15: error: redefinition of 's' void f(struct s { int y; } v) { ^ bug.c:2:8: note: previous definition is here struct s { int x; }; ^ bug.c:7:15: warning: declaration of 'struct t' will not be visible outside of this function void g(struct t { int x; } *v) { ^ 3 diagnostics generated. $ gcc -c -w bug.c bug.c: In function 'g': bug.c:8: error: redefinition of 'struct t' $

llvmbot avatar Feb 14 '10 18:02 llvmbot

Fixed in r151638.

jmolloy avatar Feb 28 '12 20:02 jmolloy

Still repos in ToT

AaronBallman avatar Feb 05 '12 20:02 AaronBallman

This bug is still present in SVN HEAD.

llvmbot avatar Dec 10 '10 16:12 llvmbot

This bug is still present in SVN HEAD.

llvmbot avatar Aug 06 '10 10:08 llvmbot

Ok, just thought we were rejecting something poorly. That definitely does look like a bug.

lattner avatar Feb 16 '10 20:02 lattner

I am not sure I understand why the keyword "quality-of-implementation" was added. Perhaps because I supplied a testcase that was illegal both for GCC and for clang (I did that only to show that clang seems to have the logic backwards).

Here is a legal testcase, accepted by GCC, the Intel C compiler, and Comeau C, but rejected by clang:

struct s { int x; };

void f(struct s { int y; }* v) { struct s a; a.y = 2; }

llvmbot avatar Feb 16 '10 20:02 llvmbot