Thanks for using Compiler Explorer
Sponsors
Jakt
C++
Ada
Analysis
Android Java
Android Kotlin
Assembly
C
C3
Carbon
C++ (Circle)
CIRCT
Clean
CMake
CMakeScript
COBOL
C++ for OpenCL
MLIR
Cppx
Cppx-Blue
Cppx-Gold
Cpp2-cppfront
Crystal
C#
CUDA C++
D
Dart
Elixir
Erlang
Fortran
F#
GLSL
Go
Haskell
HLSL
Hook
Hylo
IL
ispc
Java
Julia
Kotlin
LLVM IR
LLVM MIR
Modula-2
Nim
Objective-C
Objective-C++
OCaml
OpenCL C
Pascal
Pony
Python
Racket
Ruby
Rust
Snowball
Scala
Solidity
Spice
SPIR-V
Swift
LLVM TableGen
Toit
TypeScript Native
V
Vala
Visual Basic
WASM
Zig
Javascript
GIMPLE
Ygen
circle source #1
Output
Compile to binary object
Link to binary
Execute the code
Intel asm syntax
Demangle identifiers
Verbose demangling
Filters
Unused labels
Library functions
Directives
Comments
Horizontal whitespace
Debug intrinsics
Compiler
Build 128
Build 129
Build 131
Latest
Options
Source code
#feature on safety // Function parameters have different lifetime parameters. // Return type is constrained by x's lifetime. auto f1/(a, b)(int^/a x, int^/b y, bool pred) safe -> int^/a { // Error: // function auto f1/(a, b)(int^/a, int^/b) -> int^/a returns // object with lifetime b, but b doesn't outlive a // return y; return pred ? x : y; } // Function parameters have a common lifetime parameter. auto f2/(a)(int^/a x, int^/a y, bool pred) safe -> int^/a { // Ok return pred ? x : y; } // Error: // cannot use lifetime elision for return type int^ auto f3(int^ x, int^ y) safe -> int^;
Become a Patron
Sponsor on GitHub
Donate via PayPal
Source on GitHub
Mailing list
Installed libraries
Wiki
Report an issue
How it works
Contact the author
CE on Mastodon
About the author
Statistics
Changelog
Version tree