[Bug c++/85500] New: auto specifier incorrectly defining new function when initializing from function identifier

aaron_sami_abassi at hotmail dot com gcc-bugzilla@gcc.gnu.org
Mon Apr 23 08:56:00 GMT 2018


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

            Bug ID: 85500
           Summary: auto specifier incorrectly defining new function when
                    initializing from function identifier
           Product: gcc
           Version: 7.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: aaron_sami_abassi at hotmail dot com
  Target Milestone: ---

When initializing an auto variable from a function identifier, GNU C++ is
incorrectly defining a new function.

The statement:

auto variable_name = function_name;

Will define a function or nested function depending on the scope of reference
named variable_name.  This is not a pedantically correct interpretation of the
C++ source code as only variables can be initialized.

Also be careful in your bug correction:

auto function_name;

Should still be treated as a function declaration when initialization is not
present (as of C++14).


More information about the Gcc-bugs mailing list