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: unassignedclangb...@nondot.org
          Reporter: anders.granlun...@gmail.com
                CC: llvmbugs@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.
_______________________________________________
LLVMbugs mailing list
LLVMbugs@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to