[PATCH] D40948: Switch Clang's default C++ language target to C++14

Richard Smith - zygoloid via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 7 14:54:50 PST 2017


rsmith added a comment.

In https://reviews.llvm.org/D40948#948843, @t.p.northover wrote:

> Thanks Richard. I'll file the bugs tomorrow for the issues you suggest. Do you see either of them blocking the change to C++14 as a default? On a scale of "no", "no but I want a commitment to fix them" and "yes" sort of thing.


I don't think these should block the change of default. The //new-expression// one is actually a missing C++14 feature -- we're supposed to be generating a call to a new ABI entry point in the negative-array-bound case to throw a `std::bad_array_new_length` (we missed it because it's a feature added by a core issue rather than by a paper as I recall). I see no problem with shipping a Clang 6 that doesn't implement the full feature, including throwing the new exception. I'm not entirely happy about shipping Clang 6 without fixing the negative-bound check, since that means we'll generate code that is less hardened against certain common attacks by default, but I don't think I would be release-blocker-level unhappy.



================
Comment at: clang/test/CodeGenCXX/vtable-available-externally.cpp:1-2
-// RUN: %clang_cc1 %s -I%S -triple=x86_64-apple-darwin10 -emit-llvm -o %t
-// RUN: %clang_cc1 %s -I%S -triple=x86_64-apple-darwin10 -O2 -disable-llvm-passes -emit-llvm -o %t.opt
+// RUN: %clang_cc1 %s -I%S -triple=x86_64-apple-darwin10 -std=c++98 -emit-llvm -o %t
+// RUN: %clang_cc1 %s -I%S -triple=x86_64-apple-darwin10 -std=c++98 -O2 -disable-llvm-passes -emit-llvm -o %t.opt
 // RUN: FileCheck --check-prefix=CHECK-TEST1 %s < %t
----------------
t.p.northover wrote:
> rsmith wrote:
> > Why does this one need a -std= flag?
> It's a bit late here so I'll just give the proximal cause this evening in case that makes it obvious to you. I'll dig deeper tomorrow if not.
> 
> In this particular case (without the std flag) on the -O2 run line the "vtable for Test11::D" does not get marked "available_externally".
> 
> The diff on line 1 is definitely unneeded.
See comment below.


================
Comment at: clang/test/CodeGenCXX/vtable-available-externally.cpp:275
 struct C {
   virtual D& operator=(const D&);
 };
----------------
To make this test work in C++11 onwards, you need to add a virtual move assignment operator here:

```
virtual D& operator=(D&&);
```


Repository:
  rC Clang

https://reviews.llvm.org/D40948





More information about the cfe-commits mailing list