================
@@ -138,12 +138,12 @@ class TranslationUnitDecl : public Decl,
   using redeclarable_base::redecls_begin;
   using redeclarable_base::redecls_end;
 
-  ASTContext &getASTContext() const { return Ctx; }
+  ASTContext &getASTContext() const { return const_cast<ASTContext &>(Ctx); }
----------------
Endilll wrote:

Also see 
https://github.com/llvm/llvm-project/blob/3fdec1c9f9469587de24a525b48aa6ceddc392f5/clang/include/clang/AST/DeclBase.h#L2128-L2130
 as an example how we use `const_cast` to deduplicate body of const-qualified 
overload.

https://github.com/llvm/llvm-project/pull/185401
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to