http://llvm.org/bugs/show_bug.cgi?id=16860
Richard Smith <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |[email protected] Resolution|--- |INVALID --- Comment #1 from Richard Smith <[email protected]> --- This code is ill-formed. int arr[rt.value]; is accepted because, as a GNU/C++14 extension, we accept variable-length arrays ("arrays of runtime bound" in C++14 parlance) by default. We'll reject that too if you build with -pedantic-errors. 'rt.value' is not a constant expression because the evaluation of 'rt' as an lvalue is not permitted in a constant expression: a reference can only be used in a constant expression if it is initialized by a constant expression (see 5.19/2). 't' is not a reference constant expression because it is an object of automatic storage duration (see 5.19/4). I sympathize here -- the code is certainly reasonable -- but gcc is wrong to accept it. The natural way to allow this would be to weaken the requirement on references from "initialized by a constant expression" to "initialized by a core constant expression", but this code example alone doesn't seem like sufficient justification for that. -- You are receiving this mail because: You are on the CC list for the bug.
_______________________________________________ LLVMbugs mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs
