diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-11-08 03:40:48 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-11-08 03:40:48 +0000 |
commit | e81f58e1801176942d2d47b1b7027c4dfb7d9d1b (patch) | |
tree | be6b8cd51cd38166f5f36c0c08ef97fcb21c9a50 /clang/test/SemaCXX/addr-of-overloaded-function.cpp | |
parent | 21184644afefd30f76098b2b48abe6d6ae0fc115 (diff) | |
download | bcm5719-llvm-e81f58e1801176942d2d47b1b7027c4dfb7d9d1b.tar.gz bcm5719-llvm-e81f58e1801176942d2d47b1b7027c4dfb7d9d1b.zip |
Properly diagnose invalid casts to function references. Patch by
Faisal Vali, tweaked by me. Fixes PR8230.
llvm-svn: 118400
Diffstat (limited to 'clang/test/SemaCXX/addr-of-overloaded-function.cpp')
-rw-r--r-- | clang/test/SemaCXX/addr-of-overloaded-function.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/clang/test/SemaCXX/addr-of-overloaded-function.cpp b/clang/test/SemaCXX/addr-of-overloaded-function.cpp index ab80d8f1416..c095e946c8b 100644 --- a/clang/test/SemaCXX/addr-of-overloaded-function.cpp +++ b/clang/test/SemaCXX/addr-of-overloaded-function.cpp @@ -1,6 +1,6 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s -int f(double); -int f(int); +int f(double); // expected-note{{candidate function}} +int f(int); // expected-note{{candidate function}} int (*pfd)(double) = f; // selects f(double) int (*pfd2)(double) = &f; // selects f(double) @@ -9,7 +9,7 @@ int (*pfi)(int) = &f; // selects f(int) // FIXME: This error message is not very good. We need to keep better // track of what went wrong when the implicit conversion failed to // give a better error message here. -int (*pfe)(...) = &f; // expected-error{{cannot initialize a variable of type 'int (*)(...)' with an rvalue of type '<overloaded function type>'}} +int (*pfe)(...) = &f; // expected-error{{address of overloaded function 'f' does not match required type 'int (...)'}} int (&rfi)(int) = f; // selects f(int) int (&rfd)(double) = f; // selects f(double) @@ -98,10 +98,10 @@ namespace PR7971 { } namespace PR8033 { - template <typename T1, typename T2> int f(T1 *, const T2 *); // expected-note{{candidate function [with T1 = const int, T2 = int]}} - template <typename T1, typename T2> int f(const T1 *, T2 *); // expected-note{{candidate function [with T1 = int, T2 = const int]}} + template <typename T1, typename T2> int f(T1 *, const T2 *); // expected-note 2{{candidate function [with T1 = const int, T2 = int]}} + template <typename T1, typename T2> int f(const T1 *, T2 *); // expected-note 2{{candidate function [with T1 = int, T2 = const int]}} int (*p)(const int *, const int *) = f; // expected-error{{address of overloaded function 'f' is ambiguous}} \ - // expected-error{{cannot initialize a variable of type}} + // expected-error{{address of overloaded function 'f' is ambiguous}} } |