[llvm-bugs] [Bug 50376] New: Explicit template instantiation fails for templated constructor.
via llvm-bugs
llvm-bugs at lists.llvm.org
Mon May 17 09:09:29 PDT 2021
https://bugs.llvm.org/show_bug.cgi?id=50376
Bug ID: 50376
Summary: Explicit template instantiation fails for templated
constructor.
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: C++
Assignee: unassignedclangbugs at nondot.org
Reporter: qtom.boehmer at googlemail.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
##### Begin Example: https://godbolt.org/z/87PcP68zo
struct B
{
B() = default;
template<typename T>
B()
{}
template<typename T>
B construct() { return B{}; }
};
// This works.
//template B B::construct<int>(); // ok
// None of these compile in Clang. GCC compiles them fine.
//template B::B<int>(); // (1) fails to compile
//template B::template B<int>(); // (2) fails to compile
//template B B::template construct<int>(); // (3) fails to compile
##### End Example
##### Begin Error Messages
# Error Message for (1):
<source>:18:13: error: qualified reference to 'B' is a constructor name rather
than a type in this context
template B::B<int>(); // fails to compile
^
<source>:18:14: error: expected unqualified-id
template B::B<int>(); // fails to compile
^
2 errors generated.
# Error Message for (2):
<source>:19:22: error: 'B' following the 'template' keyword does not refer to a
template
template B::template B<int>(); // fails to compile
~~~~~~~~~~~ ^
<source>:1:8: note: declared as a non-template here
struct B
^
<source>:19:29: error: expected unqualified-id
template B::template B<int>(); // fails to compile
# Error Message for (3):
<source>:19:15: error: 'template' keyword not permitted here
template B B::template construct<int>(); // (3) fails to compile
^~~~~~~~~
1 error generated.
##### End Error Messages
--
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/20210517/1e2966a7/attachment.html>
More information about the llvm-bugs
mailing list