/cp
[official-gcc.git] / gcc / testsuite / g++.dg / cpp1y / pr82373.C
blob8a2d75520fb4a7531d6826bd83cbcd24b0cbc45d
1 // PR c++/82373
2 // { dg-do compile { target c++14 } }
4 namespace N
6   int (*fp)(int);
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   }
14 int (*fp2)(int);
15 auto bar(int a)         // { dg-message "In function 'auto bar\\(int\\)'" "" { target *-*-* } 0 }
17   if (a)
18     return fp2;
19   return nullptr;       // { dg-error "inconsistent deduction for auto return type: 'int \\(\\*\\)\\(int\\)' and then 'std::nullptr_t'" } */