microsoft / microsoft/wil

C6319 warnings from WIL header files

Open
#124 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

code-analysis
Dominant language
C++
Stars
3k
Forks
300
Avg merge
19h 12m
Merged PRs (30d)
1

Description

Using VS 2019 version 16.5.2 (which defaults to /W3 and /permissive-):

  1. Create a new Console App (C++) Project.
  2. Install the NuGet package Microsoft.Windows.ImplementationLibrary version 1.0.191107.2.
  3. Update the .cpp file to use the contents below.
  4. Build (and maybe wait a minute for warnings analysis to occur).
#include <wil/resource.h>
#include "Windows.h"

BOOL EmulateWin32ApiFailure()
{
    SetLastError(ERROR_ACCESS_DENIED);
    return FALSE;
}

int main()
{
    try
    {
        THROW_IF_WIN32_BOOL_FALSE(EmulateWin32ApiFailure());
        return 0;
    }
    catch (const wil::ResultException& exception)
    {
        return exception.GetErrorCode();
    }
}

Expected result:
Build succeeds with 0 warnings.

Actual result:
Build succeeds but has 27 warnings for C6319: Use of the comma-operator in a tested expression causes the left argument to be ignored when it has no side-effects.

Contributor guide

No contributing guide indexed for this repository

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

Reproduce the warning with the provided Visual Studio 2019 console-app example and inspect the WIL header included through wil/resource.h. Confirm which header or macro produces the C6319 diagnostics, then verify the build completes with zero warnings using the same example.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
operating-systems, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.