mirror of
https://github.com/1dot13/source.git
synced 2026-07-29 13:52:17 +02:00
drop typename from two non-type template parameters
AutoCArray takes its allocator and deallocator as template parameters:
template<typename T, typename void*(*Alloc)(size_t) = malloc,
typename void(*Dealloc)(void*) = free>
Alloc and Dealloc are function pointers, so they are values, not types, and
typename has no business in front of them. MSVC ignores the keyword there;
clang stops at it and cannot parse the parameter list, which fails every
translation unit that reaches this header.
Removing the two stray keywords leaves the parameters exactly as they were
meant to be read, with the same defaults of malloc and free. Nothing in the
tree instantiates AutoCArray, so nothing depends on the spelling either way.
Verification:
grep -rn 'AutoCArray' --include=*.cpp --include=*.h . # only this header
ninja -C build parse # sgp_auto_memory.h clean
ninja -C build -k 0 # Release, four applications, green
ninja -C build-debug -k 0 # Debug, four applications, green
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
committed by
majcosta
co-authored by
Claude Opus 4.8
parent
42b947d470
commit
897d3737c4
@@ -63,7 +63,7 @@ namespace sgp
|
||||
|
||||
/************************************************************/
|
||||
|
||||
template<typename T, typename void*(*Alloc)(size_t) = malloc, typename void(*Dealloc)(void*) = free>
|
||||
template<typename T, void*(*Alloc)(size_t) = malloc, void(*Dealloc)(void*) = free>
|
||||
class AutoCArray : public TAutoArray<T>
|
||||
{
|
||||
public:
|
||||
|
||||
Reference in New Issue
Block a user