| // RUN: %clang_cc1 -std=c++23 -verify %s |
| if consteval { return 0; } |
| if !consteval { return 0.0; } // expected-error {{'auto' in return type deduced as 'double' here but deduced as 'int' in earlier return statement}} |
| if !consteval { return 0; } |
| if consteval { return 0.0; } // expected-error {{'auto' in return type deduced as 'double' here but deduced as 'int' in earlier return statement}} |
| if consteval { return 0; } |
| if !consteval { return 0; } // okay |
| if consteval { // expected-warning {{consteval if is always true in an immediate context}} |
| return 1.0; // expected-error {{'auto' in return type deduced as 'double' here but deduced as 'int' in earlier return statement}} |
| consteval int *make() { return new int; } |
| // Immediate function context, so call to `make()` is valid. |
| // Discarded statement context, so `return 0;` is valid too. |