Skip to content

Erroneous LValue RValue Ambiguity #4953

Open
@dstodev

Description

@dstodev

Type: LanguageService

Describe the bug

  • OS and Version: MacOS Catalina 10.15.3
  • VS Code Version: 1.42.0
  • C/C++ Extension Version: 0.26.3
  • Other extensions you installed (and if the issue persists after disabling them): CMake-Tools
  • A clear and concise description of what the bug is:

With two functions:

template<typename T>
void fun(T& v)

template<typename T>
void fun(T&& v)

Calling them like:

int a = 1;
fun(a);
fun(2);

will cause a red squiggle to appear under fun(a) with the following message:

more than one instance of overloaded function "printValueCategory" matches the argument list: -- function template "void printValueCategory(T &v)" -- function template "void printValueCategory(T &&v)" -- argument types are: (int)

Program still compiles and executes correctly.

Expected behavior
Call is not labeled as ambiguous.

Additional context
Probably related: http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1164

The same compiler that succeeds in compiling the program is the same one being used by the intellisense engine.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Language ServiceVisual StudioInherited from Visual Studiobugmore votes neededIssues that have been postponed until more community members upvote it

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions