mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-05-13 17:37:00 +00:00

Previously, if a class with a defined public virtual destructor is declared before including <initializer_list> and initializer_list is provided via a Clang module, then overload resolution would fail for std::initializer_list. This is because when Clang sees the virtual destructor, Clang creates an implicit NamespaceDecl for std to implicitly declare a std::bad_alloc. That NamespaceDecl is not added to the translation unit's lookup table, so when the module containing std::initializer_list is imported later, that module's std NamespaceDecl can't find the previous std NamespaceDecl during redeclaration lookup, causing overload resolution to fail. To fix this, implicitly created std NamespaceDecls are now added to the lookup map. At the same time, their IdentifierNamespace members are cleared to prevent regular name lookups from finding it. Fixes 60929 Reviewed By: ChuanqiXu, #clang-language-wg, inclyc Differential Revision: https://reviews.llvm.org/D150001
20 lines
437 B
C++
20 lines
437 B
C++
// RUN: rm -rf %t
|
|
//
|
|
// RUN: %clang_cc1 -x c++ -fmodules -fmodules-cache-path=%t \
|
|
// RUN: -I %S/Inputs/initializer_list \
|
|
// RUN: -fmodule-map-file=%S/Inputs/initializer_list/direct.modulemap \
|
|
// RUN: %s -verify
|
|
|
|
// expected-no-diagnostics
|
|
|
|
class C {
|
|
public:
|
|
virtual ~C() {}
|
|
};
|
|
|
|
#include "Inputs/initializer_list/direct.h"
|
|
|
|
void takesInitList(std::initializer_list<int>);
|
|
|
|
void passesInitList() { takesInitList({0}); }
|