Make constant initialization failure an unrecoverable error
commitd09cc6b6b64810c3dc95c9df3809a0988da7c934
authorShayne Fletcher <shaynefletcher@fb.com>
Thu, 25 Mar 2021 02:15:05 +0000 (24 19:15 -0700)
committerFacebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
Tue, 30 Mar 2021 19:53:08 +0000 (30 12:53 -0700)
tree3b349ec80689c24e771bd9419677fa0cf1b8b8aa
parent01678808524acc150131e6d39876b0cea02ede94
Make constant initialization failure an unrecoverable error

Summary: With the introduction of enum classes, we relaxed a long held restriction that objects may not be class constants. Of course, object initialization can fail with exceptions. If this were to happen when the object being initialized is a class constant (that is, an enum class member) there is no scenario in which it makes sense for the program not to terminate. Thus, we catch such exceptions in `clsCnsGet()` and `raise_error()`.

Reviewed By: paulbiss

Differential Revision: D27300014

fbshipit-source-id: cd1abf447fe592148d8932c39081789c8a2d8091
hphp/runtime/vm/class.cpp
hphp/test/slow/enum_class/enum_class19.php [new file with mode: 0644]
hphp/test/slow/enum_class/enum_class19.php.expectf [new file with mode: 0644]