diff options
author | Matheus Izvekov <mizvekov@gmail.com> | 2021-06-22 03:48:51 +0200 |
---|---|---|
committer | Matheus Izvekov <mizvekov@gmail.com> | 2021-06-26 00:08:02 +0200 |
commit | ad14b5b008e2f643cb989ec645f12bf26a8659bb (patch) | |
tree | 238d15de5ae4dd0f9f32730d7adc55090664cfd8 /clang/test/FixIt | |
parent | ffc0533855871f4c784f6535044ce7c2bd076392 (diff) | |
download | llvm-ad14b5b008e2f643cb989ec645f12bf26a8659bb.zip llvm-ad14b5b008e2f643cb989ec645f12bf26a8659bb.tar.gz llvm-ad14b5b008e2f643cb989ec645f12bf26a8659bb.tar.bz2 |
[clang] Stop providing builtin overload candidate for relational function pointer comparisons
Word on the grapevine was that the committee had some discussion that
ended with unanimous agreement on eliminating relational function pointer comparisons.
We wanted to be bold and just ban all of them cold turkey.
But then we chickened out at the last second and are going for
eliminating just the spaceship overload candidate instead, for now.
See D104680 for reference.
This should be fine and "safe", because the only possible semantic change this
would cause is that overload resolution could possibly be ambiguous if
there was another viable candidate equally as good.
But to save face a little we are going to:
* Issue an "error" for three-way comparisons on function pointers.
But all this is doing really is changing one vague error message,
from an "invalid operands to binary expression" into an
"ordered comparison of function pointers", which sounds more like we mean business.
* Otherwise "warn" that comparing function pointers like that is totally
not cool (unless we are told to keep quiet about this).
Signed-off-by: Matheus Izvekov <mizvekov@gmail.com>
Reviewed By: rsmith
Differential Revision: https://reviews.llvm.org/D104892
Diffstat (limited to 'clang/test/FixIt')
-rw-r--r-- | clang/test/FixIt/fixit.cpp | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/clang/test/FixIt/fixit.cpp b/clang/test/FixIt/fixit.cpp index bfff20e..8a3500c 100644 --- a/clang/test/FixIt/fixit.cpp +++ b/clang/test/FixIt/fixit.cpp @@ -1,12 +1,12 @@ -// RUN: %clang_cc1 -pedantic -Wall -Wno-unused-but-set-variable -Wno-comment -verify -fcxx-exceptions -x c++ -std=c++98 %s +// RUN: %clang_cc1 -pedantic -Wall -Wno-unused-but-set-variable -Wno-comment -verify -fcxx-exceptions -x c++ -std=c++98 -Wno-c++14-extensions %s // RUN: cp %s %t-98 -// RUN: not %clang_cc1 -pedantic -Wall -Wno-unused-but-set-variable -Wno-comment -fcxx-exceptions -fixit -x c++ -std=c++98 %t-98 -// RUN: %clang_cc1 -fsyntax-only -pedantic -Wall -Wno-unused-but-set-variable -Werror -Wno-comment -fcxx-exceptions -x c++ -std=c++98 %t-98 -// RUN: not %clang_cc1 -fsyntax-only -pedantic -fdiagnostics-parseable-fixits -x c++ -std=c++11 %s 2>&1 | FileCheck %s -// RUN: %clang_cc1 -pedantic -Wall -Wno-unused-but-set-variable -Wno-comment -verify -fcxx-exceptions -x c++ -std=c++11 %s +// RUN: not %clang_cc1 -pedantic -Wall -Wno-unused-but-set-variable -Wno-comment -fcxx-exceptions -fixit -x c++ -std=c++98 -Wno-c++14-extensions %t-98 +// RUN: %clang_cc1 -fsyntax-only -pedantic -Wall -Wno-unused-but-set-variable -Werror -Wno-comment -fcxx-exceptions -x c++ -std=c++98 -Wno-c++14-extensions %t-98 +// RUN: not %clang_cc1 -fsyntax-only -pedantic -fdiagnostics-parseable-fixits -x c++ -std=c++11 -Wno-c++14-extensions %s 2>&1 | FileCheck %s +// RUN: %clang_cc1 -pedantic -Wall -Wno-unused-but-set-variable -Wno-comment -verify -fcxx-exceptions -x c++ -std=c++11 -Wno-c++14-extensions %s // RUN: cp %s %t-11 -// RUN: not %clang_cc1 -pedantic -Wall -Wno-unused-but-set-variable -Wno-comment -fcxx-exceptions -fixit -x c++ -std=c++11 %t-11 -// RUN: %clang_cc1 -fsyntax-only -pedantic -Wall -Wno-unused-but-set-variable -Werror -Wno-comment -fcxx-exceptions -x c++ -std=c++11 %t-11 +// RUN: not %clang_cc1 -pedantic -Wall -Wno-unused-but-set-variable -Wno-comment -fcxx-exceptions -fixit -x c++ -std=c++11 -Wno-c++14-extensions %t-11 +// RUN: %clang_cc1 -fsyntax-only -pedantic -Wall -Wno-unused-but-set-variable -Werror -Wno-comment -fcxx-exceptions -x c++ -std=c++11 -Wno-c++14-extensions %t-11 /* This is a test of the various code modification hints that are provided as part of warning or extension diagnostics. All of the @@ -292,21 +292,21 @@ namespace greatergreater { template<template<typename>> struct TemplateTemplateParam; // expected-error {{requires 'class'}} - template<typename T> void t(); + template <typename T> int t = 0; void g() { - void (*p)() = &t<int>; - (void)(&t<int>==p); // expected-error {{use '> ='}} - (void)(&t<int>>=p); // expected-error {{use '> >'}} + int p = 0; + (void)(t<int>==p); // expected-error {{use '> ='}} + (void)(t<int>>=p); // expected-error {{use '> >'}} #if __cplusplus < 201103L - (void)(&t<S<int>>>=p); // expected-error {{use '> >'}} - (Shr)&t<S<int>>>>=p; // expected-error {{use '> >'}} + (void)(t<S<int>>>=p); // expected-error {{use '> >'}} + (Shr)t<S<int>>>>=p; // expected-error {{use '> >'}} #endif - // FIXME: We correct this to '&t<int> > >= p;' not '&t<int> >>= p;' - //(Shr)&t<int>>>=p; + // FIXME: We correct this to 't<int> > >= p;' not 't<int> >>= p;' + //(Shr)t<int>>>=p; // FIXME: The fix-its here overlap. - //(void)(&t<S<int>>==p); + //(void)(t<S<int>>==p); } } |