1--TEST--
2Check that const exprs are pre-evaluated in new arguments
3--FILE--
4<?php
5
6class C {
7    public function __construct(public $x) {}
8}
9function test(
10    $a = new C(__CLASS__),
11    $b = new C(__FUNCTION__),
12    $c = new C(x: __FILE__),
13) {
14    var_dump($a, $b, $c);
15}
16test();
17
18// Check that nested new works as well.
19function test2($p = new C(new C(__FUNCTION__))) {
20    var_dump($p);
21}
22test2();
23
24?>
25--EXPECTF--
26object(C)#1 (1) {
27  ["x"]=>
28  string(0) ""
29}
30object(C)#2 (1) {
31  ["x"]=>
32  string(4) "test"
33}
34object(C)#3 (1) {
35  ["x"]=>
36  string(%d) "%snew_arg_eval.php"
37}
38object(C)#3 (1) {
39  ["x"]=>
40  object(C)#2 (1) {
41    ["x"]=>
42    string(5) "test2"
43  }
44}
45