[PATCH] D114833: [modules] Fix ambiguous name lookup for enum constants from hidden submodules.

Volodymyr Sapsai via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 1 19:37:52 PST 2021


vsapsai added a comment.

As I was trying to replicate C++ behavior I've created a test case ambiguous-anonymous-enum-lookup.cpp. And it results in diagnostics

  clang/test/Modules/Output/ambiguous-anonymous-enum-lookup.cpp.tmp/test.cpp:6:10: warning: ambiguous use of internal linkage declaration 'kAnonymousEnumValue' defined in multiple modules [-Wmodules-ambiguous-internal-linkage]
    return kAnonymousEnumValue;
           ^
  clang/test/Modules/Output/ambiguous-anonymous-enum-lookup.cpp.tmp/include/textual.h:5:3: note: declared here
    kAnonymousEnumValue = 0,
    ^
  clang/test/Modules/Output/ambiguous-anonymous-enum-lookup.cpp.tmp/include/textual.h:5:3: note: declared here in module 'Piecewise.InitiallyHidden'
    kAnonymousEnumValue = 0,
    ^

Is this warning correct or is it wrong and we have the same bug both in ObjC and C++? I feel I am biased (and bad at C++ linkage rules), so need a separate opinion on correctness.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D114833/new/

https://reviews.llvm.org/D114833



More information about the cfe-commits mailing list