aboutsummaryrefslogtreecommitdiff
path: root/examples/cpp2_cppfront/default.cpp2
diff options
context:
space:
mode:
authorMatt Godbolt <matt@godbolt.org>2022-09-20 07:42:41 -0500
committerGitHub <noreply@github.com>2022-09-20 07:42:41 -0500
commita8a666aeacde683a8ef1e027f26a5cdd08bade8f (patch)
tree73c7039fd4aa4c0a0060aaec31eb315e3626f2a4 /examples/cpp2_cppfront/default.cpp2
parent377c907af44348fd6859f2def84a4971ccc1e2c2 (diff)
downloadcompiler-explorer-a8a666aeacde683a8ef1e027f26a5cdd08bade8f.tar.gz
compiler-explorer-a8a666aeacde683a8ef1e027f26a5cdd08bade8f.zip
Fixes for cppfront (#4076)gh-4280
* Rename cppx_cppfront to cpp2_cppfront * Add some blurb about the compiler * Some syntax highlighting * Better output highlighting * Some form of line tracking and filtering
Diffstat (limited to 'examples/cpp2_cppfront/default.cpp2')
-rw-r--r--examples/cpp2_cppfront/default.cpp217
1 files changed, 17 insertions, 0 deletions
diff --git a/examples/cpp2_cppfront/default.cpp2 b/examples/cpp2_cppfront/default.cpp2
new file mode 100644
index 000000000..99fc51b6c
--- /dev/null
+++ b/examples/cpp2_cppfront/default.cpp2
@@ -0,0 +1,17 @@
+#include <iostream>
+#include <string>
+
+name: () -> std::string = {
+ s: std::string = "world";
+ decorate(s);
+ return s;
+}
+
+decorate: (inout s: std::string) = {
+ s = "[" + s + "]";
+}
+
+auto main() -> int {
+ // name();
+ std::cout << "Hello " << name() << "\n";
+}