https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104792
--- Comment #2 from Arthur O'Dwyer <arthur.j.odwyer at gmail dot com> --- @Andrew Pinski: Sorry, looks like my description ended up not matching the Godbolt (I said "three lines marked X," but there are only two lines marked X, for example.) Here's the Godbolt with one of the two lines commented out. The annoying warning is present. // https://godbolt.org/z/Ms4sePPfe #include <iterator> void test() { struct It { using value_type = int; using difference_type = int; int& operator*() const; It& operator++(); // X // It operator++(int); // X }; static_assert(std::is_same_v< std::iter_value_t<It>, int>); static_assert(std::is_same_v< std::iter_rvalue_reference_t<It>, int&&>); } $ g++ -std=c++20 -Wall -Wextra test.cpp test.cpp: In function 'void test()': test.cpp:6:15: warning: typedef 'using difference_type = int' locally defined but not used [-Wunused-local-typedefs] 6 | using difference_type = int; | ^~~~~~~~~~~~~~~