[llvm-bugs] [Bug 42125] New: Cannot use alias template in friend declaration

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Jun 4 13:35:00 PDT 2019


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

            Bug ID: 42125
           Summary: Cannot use alias template in friend declaration
           Product: clang
           Version: 8.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: marco.clemencic at cern.ch
                CC: blitzrakete at gmail.com, dgregor at apple.com,
                    erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
                    richard-llvm at metafoo.co.uk

Hi,

trying to use an alias template in a friend declaration fails with "error:
redefinition of 'XYZ' as different kind of symbol".

This piece of code fails to compile on clang-8:
~~~
template<typename T>
class ActualStuff {};

template <typename B>
class Other {
public:
    template<typename T>
    using Stuff = ActualStuff<T>;

#if 1
    // this fails with:
    // error: redefinition of 'Stuff' as different kind of symbol
    template<typename>
    friend class Stuff;
#else
    // this works
    template<typename>
    friend class ActualStuff;
#endif
};
~~~

And the only way I found to make it work (as shown in the example) is to bypass
the alias.

As a side note, gcc accepts the code in the example.

Cheers
Marco

-- 
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/20190604/e002e048/attachment.html>


More information about the llvm-bugs mailing list