summaryrefslogtreecommitdiff
path: root/var/spack/repos/builtin/packages/cxx/test
diff options
context:
space:
mode:
Diffstat (limited to 'var/spack/repos/builtin/packages/cxx/test')
-rw-r--r--var/spack/repos/builtin/packages/cxx/test/hello.c++9
-rw-r--r--var/spack/repos/builtin/packages/cxx/test/hello.cc9
-rw-r--r--var/spack/repos/builtin/packages/cxx/test/hello.cpp9
-rw-r--r--var/spack/repos/builtin/packages/cxx/test/hello_c++11.cc17
4 files changed, 44 insertions, 0 deletions
diff --git a/var/spack/repos/builtin/packages/cxx/test/hello.c++ b/var/spack/repos/builtin/packages/cxx/test/hello.c++
new file mode 100644
index 0000000000..f0ad7caffb
--- /dev/null
+++ b/var/spack/repos/builtin/packages/cxx/test/hello.c++
@@ -0,0 +1,9 @@
+#include <stdio.h>
+
+int main()
+{
+ printf ("Hello world from C++\n");
+ printf ("YES!");
+
+ return 0;
+}
diff --git a/var/spack/repos/builtin/packages/cxx/test/hello.cc b/var/spack/repos/builtin/packages/cxx/test/hello.cc
new file mode 100644
index 0000000000..2a85869996
--- /dev/null
+++ b/var/spack/repos/builtin/packages/cxx/test/hello.cc
@@ -0,0 +1,9 @@
+#include <iostream>
+using namespace std;
+
+int main()
+{
+ cout << "Hello world from C++!" << endl;
+ cout << "YES!" << endl;
+ return (0);
+}
diff --git a/var/spack/repos/builtin/packages/cxx/test/hello.cpp b/var/spack/repos/builtin/packages/cxx/test/hello.cpp
new file mode 100644
index 0000000000..b49db59f4a
--- /dev/null
+++ b/var/spack/repos/builtin/packages/cxx/test/hello.cpp
@@ -0,0 +1,9 @@
+#include <iostream>
+using namespace std;
+
+int main()
+{
+ cout << "Hello world from C++!" << endl;
+ cout << "YES!" << endl;
+ return (0);
+}
diff --git a/var/spack/repos/builtin/packages/cxx/test/hello_c++11.cc b/var/spack/repos/builtin/packages/cxx/test/hello_c++11.cc
new file mode 100644
index 0000000000..10f57c3f75
--- /dev/null
+++ b/var/spack/repos/builtin/packages/cxx/test/hello_c++11.cc
@@ -0,0 +1,17 @@
+#include <iostream>
+#include <regex>
+
+using namespace std;
+
+int main()
+{
+ auto func = [] () { cout << "Hello world from C++11" << endl; };
+ func(); // now call the function
+
+ std::regex r("st|mt|tr");
+ std::cout << "std::regex r(\"st|mt|tr\")" << " match tr? ";
+ if (std::regex_match("tr", r) == 0)
+ std::cout << "NO!\n ==> Using pre g++ 4.9.2 libstdc++ which doesn't implement regex properly" << std::endl;
+ else
+ std::cout << "YES!\n ==> Correct libstdc++11 implementation of regex (4.9.2 or later)" << std::endl;
+}