• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // RUN: %clang_cc1 -fsyntax-only -verify %s
2 // expected-no-diagnostics
3 struct AnyPtr {
4   template<typename T>
5   operator T*() const;
6 };
7 
8 // If A is a cv-qualified type, the top level cv-qualifiers of A's type
9 // are ignored for type deduction.
test_cvquals(AnyPtr ap)10 void test_cvquals(AnyPtr ap) {
11   int* const ip = ap;
12   const float * const volatile fp = ap;
13 }
14 
15 // If A is a reference type, the type referred to by A is used for
16 // type deduction.
test_ref_arg(AnyPtr ap)17 void test_ref_arg(AnyPtr ap) {
18   const int* const &ip = ap;
19   double * const &dp = ap;
20 }
21 
22 struct AnyRef {
23   template<typename T>
24   operator T&() const;
25 };
26 
test_ref_param(AnyRef ar)27 void test_ref_param(AnyRef ar) {
28   int &ir = ar;
29   const float &fr = ar;
30   int i = ar;
31 }
32