Skip to content
This repository was archived by the owner on Sep 13, 2022. It is now read-only.
This repository was archived by the owner on Sep 13, 2022. It is now read-only.

Build error with KTL #1

@JonCavesMSFT

Description

@JonCavesMSFT

Hi: we have recently updated the Microsoft Visual C++ compiler to give an error if a template parameter is shadowed by a function parameter - previous versions of the compiler did not detect this error, which, in some cases led to a compiler crash. Unfortunately KTL is failing to build with the new compiler because it appears to reference an old (very old?) version of the Windows SDK (and hence the CRT). If we use a new compiler we are seeing the following error:

D:\CoreXTCache\Microsoft.WindowsAzure.DirectDrive.External.Windows.sdk.10.0.14296\inc\crt\wchar.h(642): error C7576: declaration of '_Size' shadows a template parameter
D:\CoreXTCache\Microsoft.WindowsAzure.DirectDrive.External.Windows.sdk.10.0.14296\inc\crt\wchar.h(642): note: see declaration of '_Size'

This is due to this function declaration:

errno_t __cdecl _cgetws_s(wchar_t* _Buffer, size_t _SizeInWords, size_t* _SizeRead);

extern "C++"
{
        template<size_t _Size>
	inline errno_t __cdecl _cgetws_s(wchar_t (&_Buffer)[_Size], size_t* _Size)
	{
		return _cgetws_s(_Buffer, _Size, _Size);
	}
}

The definition of _cgetws_s should be:

        template<size_t _Size>
	inline errno_t __cdecl _cgetws_s(wchar_t (&_Buffer)[_Size], size_t* _SizeRead)
	{
		return _cgetws_s(_Buffer, _Size, _SizeRead);
	}

and this is what newer versions of the SDK (and hence the Unified CRT) include.

Thanks
Jonathan Caves

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions