This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/66543] New: False positive warning "variable set but not used"


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66543

            Bug ID: 66543
           Summary: False positive warning "variable set but not used"
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ldionne.2 at gmail dot com
  Target Milestone: ---

The following code triggers a "unused but set variable" warning on GCC trunk:

    int main() {
        auto f = []() { };
        [=](auto) {
            using Foo = decltype(f());
        };
    }

I think it is a false positive, since `f` is obviously used.

> g++ --version
g++ (GCC) 6.0.0 20150613 (experimental)

> g++ -std=c++14 worksheet.cpp -fsyntax-only -Wall -Wno-unused-local-typedefs

In function âint main()â:
warning: variable âfâ set but not used [-Wunused-but-set-variable]
         auto f = []() { };
              ^

Regards,
Louis Dionne

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]