[LLVMbugs] [Bug 24247] New: Error message for labeled-statement inside constexpr function body

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Jul 24 09:09:02 PDT 2015


https://llvm.org/bugs/show_bug.cgi?id=24247

            Bug ID: 24247
           Summary: Error message for labeled-statement inside constexpr
                    function body
           Product: clang
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++14
          Assignee: unassignedclangbugs at nondot.org
          Reporter: anders.granlund.0 at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Consider the following program (prog.cc):

  constexpr void f() { x: ; }
  int main() {}

It is well-formed. Observe that [dcl.constexpr]/4
(http://eel.is/c++draft/dcl.dcl#dcl.constexpr-3) does forbid goto statements,
but not labeled-statements.

Compile it with the following command-line:

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

The following error message is given:

  prog.cc:1:22: error: statement not allowed in constexpr function
  constexpr void f() { x: ; }
                     ^
  1 error generated.

Expected behaviour is to get no error messages since the program is
well-formed.

I tired it with gcc also, and it gives no error message.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150724/ff60fce9/attachment.html>


More information about the llvm-bugs mailing list