aboutsummaryrefslogtreecommitdiff
path: root/test/Frontend/noderef_templates.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/Frontend/noderef_templates.cpp')
-rw-r--r--test/Frontend/noderef_templates.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/Frontend/noderef_templates.cpp b/test/Frontend/noderef_templates.cpp
new file mode 100644
index 000000000000..5fde6efd87c7
--- /dev/null
+++ b/test/Frontend/noderef_templates.cpp
@@ -0,0 +1,15 @@
+// RUN: %clang_cc1 -verify %s
+
+#define NODEREF __attribute__((noderef))
+
+template <typename T>
+int func(T NODEREF *a) { // expected-note 2 {{a declared here}}
+ return *a + 1; // expected-warning 2 {{dereferencing a; was declared with a 'noderef' type}}
+}
+
+void func() {
+ float NODEREF *f;
+ int NODEREF *i;
+ func(f); // expected-note{{in instantiation of function template specialization 'func<float>' requested here}}
+ func(i); // expected-note{{in instantiation of function template specialization 'func<int>' requested here}}
+}