[cfe-dev] Clang 3.3 assertion failure for local extern declarations of variables with names matching function parameters
Richard Smith
richard at metafoo.co.uk
Mon Aug 5 23:40:11 PDT 2013
The code is ill-formed. We're supposed to catch this due to
[basic.scope.block]p2: "A parameter name shall not be redeclared in the
outermost block of the function definition" but our check for that seems to
be broken or missing.
On Mon, Aug 5, 2013 at 8:25 PM, Tom Honermann <thonermann at coverity.com>wrote:
> Clang 3.3, when compiled with assertions enabled, fails an assertion for
> the following test case. I believe this code is ill-formed, but at least
> some versions of gcc accept this test case (I tested 4.6.3 and 4.8.0).
> Clang 3.2 accepts this test case as well.
>
> I filed a bug report for the assertion failure [1], but thought it would
> be good to clarify expected behavior on the mailing list.
>
> $ cat t.cpp
> struct S;
> void f(S *s) {
> extern S *s;
> s;
> }
>
> $ clang --version
> clang version 3.3 (tags/RELEASE_33/final)
> Target: x86_64-unknown-linux-gnu
> Thread model: posix
>
> $ clang -c t.cpp
> clang: llvm-3.3/tools/clang/lib/AST/**Decl.cpp:932: void
> clang::NamedDecl::**verifyLinkage() const: Assertion `!D ||
> D->CachedLinkage == CachedLinkage' failed.
>
> [1]: http://llvm.org/bugs/show_bug.**cgi?id=16804<http://llvm.org/bugs/show_bug.cgi?id=16804>
>
> Tom.
>
> ______________________________**_________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/**mailman/listinfo/cfe-dev<http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130805/b240a9ed/attachment.html>
More information about the cfe-dev
mailing list