llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

False positive misc-confusable-identifier: confusing template argument and function from different classes

Open carlosgalvezp opened this issue 2 years ago • 3 comments

Getting the following on latest trunk:

#include <gtest/gtest.h>

struct Foo
{
    void l();
};
[source>:5:10: warning: 'l' is confusable with 'I' [misc-confusable-identifiers]]
    void l();
         ^
/opt/compiler-explorer/libs/googletest/trunk/googletest/include/gtest/internal/gtest-param-util.h:842:23: note: other declaration found here
  template <size_t... I>
                      ^

Repro on Compiler Explorer

carlosgalvezp avatar Oct 27 '22 12:10 carlosgalvezp

@llvm/issue-subscribers-clang-tidy

llvmbot avatar Oct 27 '22 12:10 llvmbot

Reduced self-contained example:

template <typename T>
struct Foo 
{};

template <typename T, int... I>
struct Bar : Foo<T> 
{};

struct Baz
{
    void l();
};

https://godbolt.org/z/do78n3ahh

carlosgalvezp avatar Oct 27 '22 13:10 carlosgalvezp

Need to be re-verified but example no longer produce warning on trunk.

PiotrZSL avatar Jun 28 '23 07:06 PiotrZSL

Fixed in LLVM 17. Somehow by 2a84c635f2a1dcb4546a5d751a32eac24103c7e6.

PiotrZSL avatar Mar 09 '24 19:03 PiotrZSL