Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

Error message for labeled-statement inside constexpr function body #24246

Open Quuxplusone opened 9 years ago

Quuxplusone commented 9 years ago
Bugzilla Link PR24247
Status NEW
Importance P normal
Reported by Anders Granlund (anders.granlund.0@gmail.com)
Reported on 2015-07-24 11:09:02 -0700
Last modified on 2015-07-24 20:17:27 -0700
Version trunk
Hardware All All
CC llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk
Fixed by commit(s)
Attachments
Blocks
Blocked by
See also
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.
Quuxplusone commented 9 years ago

Consensus on the core reflector is that this is a defect in the standard wording.