[llvm-bugs] [Bug 43556] New: Auto type deduction of member variable template within class template fails to compile

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Oct 4 01:06:26 PDT 2019


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

            Bug ID: 43556
           Summary: Auto type deduction of member variable template within
                    class template fails to compile
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++14
          Assignee: unassignedclangbugs at nondot.org
          Reporter: james at invexed.com
                CC: blitzrakete at gmail.com, erik.pilkington at gmail.com,
                    llvm-bugs at lists.llvm.org, richard-llvm at metafoo.co.uk

https://godbolt.org/z/cGowWI

The following code fails to compile with Clang (but is accepted by GCC and
MSVC)

    template<typename>
    struct S {
        template<typename T>
        static constexpr auto value = T{0};
    };

    int main()
    {
        return S<int>::value<int>;
    }

This can be resolved by explicitly specifying the type of S::value instead:

    template<typename T>
    static constexpr T value = T{0};

Furthermore, this bug only seems to occur if S and S::value are both templates.

-- 
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/20191004/46772c80/attachment.html>


More information about the llvm-bugs mailing list