-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Modules - unexpected error "definition with same mangled name as another definition" with lambdas #53232
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@llvm/issue-subscribers-clang-modules |
It looks like the mangler's not attaching a discriminating integer to the lambdas? http://itanium-cxx-abi.github.io/cxx-abi/abi.html#mangling <closure-type-name> ::= Ul <lambda-sig> E [ <nonnegative number> ] _ The number is omitted for the first closure type with a given <lambda-sig> in a given context; it is n-2 for the nth closure type (in [lexical order]) with that same <lambda-sig> and context. |
Curious, was this issue considered fixed along with #52857 and was simply forgotten to be closed, or is there a remaining issue? I can try to reproduce but I suspect it's going to be awkward so wanted to check first what the known status was. Also curious if this "same mangled name" error is a genuine error that can mean something is wrong with the program source code, or is it just a way of surfacing a problem with the compiler? If the former, what would be a simple example? |
I thought this is simply forgotten to be closed. I think a reproducer will be pretty helpful. |
I just spent a couple of hours trying to reduce but I'm still a long way off anything reasonable. It's happening in a very heavily nested template context, spanning module boundaries, and it's very sensitive to changes. When I tweak something, it will either disappear or, strangely, emit the same error but for some other template definition in the stack of instantiations. Since they were always pointing at lambdas inside of function templates, my gut feeling was saying it could be related to #59513 , but then the very last change I made caused the same error to show up directly on a function template, not a lambda (though perhaps it could still be related, since there are lambdas on the instantiation stack?). I need to put repro-ing it on hold for now. It's not an open source project, but if I was eventually able to get it down to a small source file plus a bunch of dependency BMIs would that be any use? Or do you need a full source code repro to be able to get anywhere? |
I need to the source code repros. The BMIs are too sensitive to be reproducer. |
Ok. Given how long it would take to reduce it down to something sensible I'm unsure I'll be able to justify the time, unless it becomes a more frequent problem. Feel free to close this issue, and if at some point I have a reproducer I'll open a new one and reference this. Cheers. |
Yeah, it is a known problem that it is hard to reproduce modules related bugs. Thanks for reaching out. |
Uh oh!
There was an error while loading. Please reload this page.
Clang will trigger a compilation error with:
This will cause the following compiler error:
greetings.cpp:6:6: error: definition with same mangled name '_ZW9greetingsE5greetIZW_0E4testvEUt_EvT_' as another definition
This happens only if the use in (B) is part of a module as well (it can be an implementation unit of the same module, or it can also be part of a second module
test
which will trigger the error as well).This seems to be some kind of variation of the following long closed bug: https://bugs.llvm.org/show_bug.cgi?id=33924
greetings.cpp
test.cpp
Compilation commands:
Alternate command if
test.cpp
is meant to be part of a different module:The text was updated successfully, but these errors were encountered: