[llvm-bugs] [Bug 49133] New: Explicit template instantiation of nested types

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Feb 10 15:31:12 PST 2021


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

            Bug ID: 49133
           Summary: Explicit template instantiation of nested types
           Product: clang
           Version: 11.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: unassignedclangbugs at nondot.org
          Reporter: tomaqa at gmail.com
                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

Clang does not accept explicit class template instantiation of a nested type.

Minimal example:

template <typename>
struct Tp {
    using Alias = Tp;
};

/// All should be valid and equivalent
extern template struct Tp<int>;             //< works
extern template struct Tp<int>::Tp;         //< fails
extern template struct Tp<int>::Alias::Tp;  //< fails

error: explicit instantiation of non-templated type 'Tp<int>'

The inst. of nested types should be standard-compliant as well as the first
one.
Also, the error message is quite confusing.
Works in GCC.

https://stackoverflow.com/questions/34506356/using-typedef-in-template-instantiation-and-extern-template-declaration/34506955#34506955
https://stackoverflow.com/questions/11414817/code-duplication-between-typedefs-and-explicit-instantiations

-- 
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/20210210/24acc9df/attachment-0001.html>


More information about the llvm-bugs mailing list