microsoft / microsoft/react-native-windows

[msvc] react-native-windows failed with warning C4864: expected 'template' keyword before dependent template name

Open Beginner friendly
#16,321 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug Needs: Triage :mag:
Dominant language
C++
Stars
17.3k
Forks
1.2k
Avg merge
1d 13h
Merged PRs (30d)
33

Description

Problem Description

When build react-native-windows with VS2026 on windows, it failed with 'warning C4864: expected 'template' keyword before dependent template name', could you please take a look?

Failures:

C:\gitP\microsoft\react-native-windows\vnext\Microsoft.ReactNative\Fabric\Composition\CompositionContextHelper.cpp(1799,52): error C2220: the following warning is treated as an error [C:\gitP\microsoft\react-native-windows\vnext\Desktop\React.Windows.Desktop.vcxproj]
         (compiling source file '../Microsoft.ReactNative/Fabric/Composition/CompositionContextHelper.cpp')
         
C:\gitP\microsoft\react-native-windows\vnext\Microsoft.ReactNative\Fabric\Composition\CompositionContextHelper.cpp(1799,52): warning C4864: expected 'template' keyword before dependent template name [C:\gitP\microsoft\react-native-windows\vnext\Desktop\React.Windows.Desktop.vcxproj]
Steps To Reproduce
  1. git clone https://github.com/microsoft/react-native-windows and checkout 883b2f4
  2. cd /d C:\gitP\microsoft\react-native-windows
  3. msbuild /m /restore /p:PlatformToolset=v145 /p:Platform=x64 /p:Configuration=Release /p:WindowsTargetPlatformVersion=10.0.26100.0 /p:PublishToolDuringBuild=true /p:RestoreLockedMode=true /p:RestoreForceEvaluate=true /p:VisualStudioVersion="18.0" vnext\ReactWindows-Desktop.sln /t:Rebuild
Expected Results

It builds successfully.

CLI version

20.0.0

Environment
nfo Fetching system and libraries information...
System:
  OS: Windows 11 10.0.26200
  CPU: (16) x64 Intel(R) Xeon(R) Platinum 8370C CPU @ 2.80GHz
  Memory: 48.74 GB / 63.95 GB
Binaries:
  Node:
    version: 20.19.4
    path: C:\Program Files\nodejs\node.EXE
  Yarn:
    version: 4.13.0
    path: C:\Program Files (x86)\Yarn\bin\yarn.CMD
  npm:
    version: 10.8.2
    path: C:\Program Files\nodejs\npm.CMD
  Watchman: Not Found
SDKs:
  Android SDK: Not Found
  Windows SDK: Not Found
IDEs:
  Android Studio: Not Found
  Visual Studio:
    - 18.7.12002.237 (Visual Studio Enterprise 2026)
Languages:
  Java: Not Found
  Ruby:
    version: 3.1.3
    path: C:\tools\ruby31\bin\ruby.EXE
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 19.2.3
    wanted: 19.2.3
  react-native:
    installed: 0.85.0-nightly-20260303-c26dbe286
    wanted: 0.85.0-nightly-20260303-c26dbe286
  react-native-windows: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: Not found
  newArchEnabled: Not found
iOS:
  hermesEnabled: Not found
  newArchEnabled: Not found
Community Modules

No response

Target React Native Architecture

None

Target Platform Version

amd64

Visual Studio Version

2026

Build Configuration

x64, Release

Snack, code example, screenshot, or link to a repository

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at vnext/Microsoft.ReactNative/Fabric/Composition/CompositionContextHelper.cpp around line 1799 and inspect the expression reported by MSVC warning C4864. Reproduce with the supplied msbuild command and Visual Studio 2026 toolset. Done means the x64 Release rebuild completes without C4864 being promoted to an error.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, react-native
Domain
build-system, operating-systems
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.