noderef_templates.cpp 543 B

123456789101112131415
  1. // RUN: %clang_cc1 -verify %s
  2. #define NODEREF __attribute__((noderef))
  3. template <typename T>
  4. int func(T NODEREF *a) { // expected-note 2 {{a declared here}}
  5. return *a + 1; // expected-warning 2 {{dereferencing a; was declared with a 'noderef' type}}
  6. }
  7. void func() {
  8. float NODEREF *f;
  9. int NODEREF *i;
  10. func(f); // expected-note{{in instantiation of function template specialization 'func<float>' requested here}}
  11. func(i); // expected-note{{in instantiation of function template specialization 'func<int>' requested here}}
  12. }