IntelliSense reports an error on a valid deduction guide (error: the return type must directly designate a specialization of the associated class template) · Issue #14824 · microsoft/vscode-cpptools · GitHub
You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
IntelliSense reports an error on a valid deduction guide (error: the return type must directly designate a specialization of the associated class template) #14824
Compilers that accept the code: Apple clang 21.0.0 (clang-2100.3.34.2), GCC 16.2.0 (-std=c++23 -Wall -Wextra -pedantic)
Bug Summary and Steps to Reproduce
Bug Summary:
IntelliSense reports an error on a valid deduction guide whose return type is an explicit specialization of the class template. Clang and GCC compile and run the code without warnings.
Steps to reproduce:
Set the "cppStandard": "gnu++20".
#include<cstddef>
#include<span>using std::size_t;
template< size_t i = std::dynamic_extent, size_t s = std::dynamic_extent >
structslice
{
staticconstexprsize_t index = i, size = s;
};
template<>
structslice< std::dynamic_extent, std::dynamic_extent >
{
size_t index = 0, size = 0;
constexprslice() noexcept = default;
constexprslice( size_t i, size_t s ) noexcept : index( i ), size( s ) {}
};
slice() -> slice<>;
slice( size_t, size_t ) -> slice<>; // error: "the return type must directly designate a specialization of the associated class template"template< size_t i, size_t s >
constexpr slice< i, s > const_slice;
auto s0 = slice{}; // OKauto s1 = slice{ 1, 2 }; // errorauto s2 = slice< 3, 4 >{}; // OKauto s3 = const_slice< 5, 6 >; // OK
slice s5 = { 2, 4 }; // error
slice s6; // OKsize_t n = 1;
auto s7 = slice{ n, 3 }; // errorintmain() {}
Update: switching to 1.35.3 only partly fixed the problem. Now the error occurs at these lines:
slice() -> slice<>; // redeclaration of deduction guide "()->slice<18446744073709551615UL, 18446744073709551615UL>" (previous declaration at line 30)slice( size_t, size_t ) -> slice<>; // rredeclaration of deduction guide "(size_t, size_t)->slice<18446744073709551615UL, 18446744073709551615UL>" (previous declaration at line 32)
Activity