r360559 - [c++20] P1064R0: Allow virtual function calls in constant expression

Hans Wennborg via cfe-commits cfe-commits at lists.llvm.org
Mon May 13 07:49:59 PDT 2019


Here's a creduced repro:

--
class a {};
class b : virtual a {
  virtual bool c(const void *, int);
};
class C : b {
public:
  bool c(const void *, int);
};
int d;
bool e() {
  C f;
  if (f.c(&d, d))
    ;
}
--

$ clang.bad -cc1 -triple x86_64-unknown-linux-gnu -fsyntax-only -std=c++14 a.cc

The assert goes away if invoking clang with -w.

From: Hans Wennborg <hans at chromium.org>
Date: Mon, May 13, 2019 at 3:16 PM
To: Richard Smith
Cc: cfe-commits

> This caused asserts in Chromium, so I've reverted in r360580. There's
> a repro at https://bugs.chromium.org/p/chromium/issues/detail?id=962458#c1,
> and I'm working on a reduced version.
>
> From: Richard Smith via cfe-commits <cfe-commits at lists.llvm.org>
> Date: Mon, May 13, 2019 at 9:39 AM
> To: <cfe-commits at lists.llvm.org>
>
> > Author: rsmith
> > Date: Mon May 13 00:42:10 2019
> > New Revision: 360559
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=360559&view=rev
> > Log:
> > [c++20] P1064R0: Allow virtual function calls in constant expression
> > evaluation.
> >
> > Modified:
> >     cfe/trunk/include/clang/AST/DeclCXX.h
> >     cfe/trunk/include/clang/Basic/DiagnosticASTKinds.td
> >     cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
> >     cfe/trunk/include/clang/Sema/Sema.h
> >     cfe/trunk/lib/AST/DeclCXX.cpp
> >     cfe/trunk/lib/AST/ExprConstant.cpp
> >     cfe/trunk/lib/Sema/SemaDeclCXX.cpp
> >     cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp
> >     cfe/trunk/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p3.cpp
> >     cfe/trunk/test/CXX/drs/dr18xx.cpp
> >     cfe/trunk/test/CXX/drs/dr6xx.cpp
> >     cfe/trunk/test/SemaCXX/constant-expression-cxx2a.cpp
> >     cfe/trunk/test/SemaCXX/cxx17-compat.cpp
> >     cfe/trunk/www/cxx_status.html


More information about the cfe-commits mailing list