1 // PR c++/82373
2 // { dg-do compile { target c++14 } }
3
4 namespace N
5 {
6 int (*fp)(int);
foo(int a)7 auto foo(int a) // { dg-message "In function 'auto N::foo\\(int\\)'" "" { target *-*-* } 0 }
8 {
9 if (a)
10 return fp;
11 return nullptr; // { dg-error "inconsistent deduction for auto return type: 'int \\(\\*\\)\\(int\\)' and then 'std::nullptr_t'" } */
12 }
13 }
14 int (*fp2)(int);
bar(int a)15 auto bar(int a) // { dg-message "In function 'auto bar\\(int\\)'" "" { target *-*-* } 0 }
16 {
17 if (a)
18 return fp2;
19 return nullptr; // { dg-error "inconsistent deduction for auto return type: 'int \\(\\*\\)\\(int\\)' and then 'std::nullptr_t'" } */
20 }
21