[llvm-bugs] [Bug 32943] New: -fmodule triggers error: reference to 'd' is ambiguous

via llvm-bugs llvm-bugs at lists.llvm.org
Fri May 5 13:31:14 PDT 2017


https://bugs.llvm.org/show_bug.cgi?id=32943

            Bug ID: 32943
           Summary: -fmodule triggers error: reference to 'd' is ambiguous
           Product: clang
           Version: 4.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Modules
          Assignee: unassignedclangbugs at nondot.org
          Reporter: mail at milianw.de
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org

Created attachment 18412
  --> https://bugs.llvm.org/attachment.cgi?id=18412&action=edit
MWE to reproduce the issue

I wanted to test the state of module support in clang 4 and how it impacts the
compile speed of KDE applications. While doing so, I found a nasty issue which
I tried to minimize as good as possible. Sadly, the test case is still pretty
large as it still depends on Qt. I do hope that someone can look into it
nevertheless. If it's too large, I will try to reduce the complexity of my
current MWE and get rid of the Qt dependency there, by somehow copying whatever
QList does to trigger this issue.

Anyhow, for now here's the clang command that triggers the issue:

~~~~~~~~~~~~~~~~~~
$ rm -Rf /tmp/org.llvm.clang.milian/; clang++ -isystem /usr/include/qt -isystem
/usr/include/qt/QtCore -I../A/  -fmodules -fPIC  -std=c++11 -o b.cpp.o -c
b.cppIn module 'QtCore' imported from ./b.h:3:
/usr/include/qt/QtCore/qlist.h:806:38: error: reference to 'd' is ambiguous
    : QListSpecialMethods<T>(l), d(l.d)
                                     ^
b.cpp:8:17: note: in instantiation of member function 'QList<int>::QList'
requested here
    auto copy = b.list;
                ^
/usr/include/qt/QtCore/qlist.h:147:43: note: candidate found by name lookup is
'QList<int>::d'
    union { QListData p; QListData::Data *d; };
                                          ^
/usr/include/qt/QtCore/qlist.h:147:43: note: candidate found by name lookup is
'QList<int>::d'
/usr/include/qt/QtCore/qlist.h:814:48: error: reference to 'p' is ambiguous
                    reinterpret_cast<Node *>(l.p.begin()));
                                               ^
/usr/include/qt/QtCore/qlist.h:147:23: note: candidate found by name lookup is
'QList<int>::p'
    union { QListData p; QListData::Data *d; };
                      ^
/usr/include/qt/QtCore/qlist.h:147:23: note: candidate found by name lookup is
'QList<int>::p'
2 errors generated.
~~~~~~~~~~~~~~~~~~

Removing `-fmodules` fixes this issue. In the attached tarball you find the two
folders that trigger this issue. Go the B/ then invoke the above command to
trigger the bug. But first, add this modulemap for QtCore:

~~~~~~~~~~~~~~~~~~
$ cat /usr/include/qt/QtCore/module.modulemap
module QtCore {
    umbrella header "QtCore"
    export *
}
~~~~~~~~~~~~~~~~~~

Note that `b.h` only includes the (empty) `a.h`, but the module of `a.h`
includes the `other.h` header which uses a `QList<int>`, just like `b.h`.

Can someone explain what's happening here? Can it be work-arounded by modifying
the module maps? I'd love to resolve this issue, as the other

Thanks

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20170505/148fbdf0/attachment.html>


More information about the llvm-bugs mailing list