Open
Description
Consider this code frequently found when interacting with C API:
void foo(void**);
void bar()
{
void* ptr{};
foo(&ptr);
}
Here, clang-tidy wants ptr
to be void const* ptr
, i.e. pointing to const void
. This change makes the program no longer compile.
https://godbolt.org/z/GrPYf7Gao
The warning goes away if I remove the braces initializing ptr
. But as a user I should be able to do that anyway (some other guidelines require this).
Metadata
Metadata
Assignees
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
llvmbot commentedon Mar 17, 2025
@llvm/issue-subscribers-clang-tidy
Author: Carlos Galvez (carlosgalvezp)
Here, clang-tidy wants
ptr
to bevoid const* ptr
, i.e. pointing toconst void
. This change makes the program no longer compile.https://godbolt.org/z/GrPYf7Gao
The warning goes away if I remove the braces initializing
ptr
. But as a user I should be able to do that anyway (some other guidelines require this).