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: unassignedclangb...@nondot.org
          Reporter: qtom.boeh...@googlemail.com
                CC: blitzrak...@gmail.com, dgre...@apple.com,
                    erik.pilking...@gmail.com, llvm-bugs@lists.llvm.org,
                    richard-l...@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to