[Bug c++/67026] New: GCC incorrectly rejects well-formed constexpr function definition

anders.granlund.0 at gmail dot com gcc-bugzilla@gcc.gnu.org
Mon Jul 27 14:24:00 GMT 2015


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

            Bug ID: 67026
           Summary: GCC incorrectly rejects well-formed constexpr function
                    definition
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: anders.granlund.0 at gmail dot com
  Target Milestone: ---

Consider the following program (proc.cc):

void g() {}
constexpr void f() { return; g(); }
int main() {}

Compile it with the following command line:

g++ prog.cc -std=c++14 -pedantic-errors

The following error message is given:

prog.cc: In function 'constexpr void f()':
prog.cc:2:31: error: call to non-constexpr function 'void g()'
 constexpr void f() { return; g(); }
                               ^
I expected to get no error message since the program is well-formed.

I have tried this with gcc HEAD 6.0.0 20150726 here:

http://melpon.org/wandbox/permlink/Hd5t7ppNQWFqioUx

For comparison clang accepts the program with no error messages.



More information about the Gcc-bugs mailing list