mirror of https://github.com/microsoft/clang.git
[modules] Properly check whether a declaration is std::initializer_list. This
bug is not actually modules-specific, but it's a little tricky to tickle it outside of modules builds, so submitting with the reduced testcase I have. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@230303 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
4b16d54f97
commit
09f959d394
|
@ -7373,7 +7373,7 @@ bool Sema::isStdInitializerList(QualType Ty, QualType *Element) {
|
|||
StdInitializerList = Template;
|
||||
}
|
||||
|
||||
if (Template != StdInitializerList)
|
||||
if (Template->getCanonicalDecl() != StdInitializerList->getCanonicalDecl())
|
||||
return false;
|
||||
|
||||
// This is an instance of std::initializer_list. Find the argument type.
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
module initializer_list { header "direct.h" }
|
|
@ -0,0 +1 @@
|
|||
#include "direct.h"
|
|
@ -0,0 +1 @@
|
|||
module initializer_list { header "indirect.h" }
|
|
@ -296,10 +296,6 @@ module warn_unused_local_typedef {
|
|||
header "warn-unused-local-typedef.h"
|
||||
}
|
||||
|
||||
module initializer_list {
|
||||
header "initializer_list"
|
||||
}
|
||||
|
||||
module using_decl {
|
||||
module a { header "using-decl-a.h" export * }
|
||||
module b { header "using-decl-b.h" export * }
|
||||
|
|
|
@ -1,7 +1,23 @@
|
|||
// RUN: rm -rf %t
|
||||
// RUN: %clang_cc1 -x objective-c++ -fmodules -fmodules-cache-path=%t -I %S/Inputs %s -verify -std=c++11
|
||||
//
|
||||
// RUN: %clang_cc1 -x objective-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 -std=c++11
|
||||
//
|
||||
// RUN: %clang_cc1 -x objective-c++ -fmodules -fmodules-cache-path=%t \
|
||||
// RUN: -I %S/Inputs/initializer_list \
|
||||
// RUN: -fmodule-map-file=%S/Inputs/initializer_list/indirect.modulemap \
|
||||
// RUN: %s -verify -std=c++11 -DINCLUDE_DIRECT
|
||||
|
||||
// expected-no-diagnostics
|
||||
|
||||
#ifdef INCLUDE_DIRECT
|
||||
#include "direct.h"
|
||||
auto k = {1, 2, 3};
|
||||
#endif
|
||||
|
||||
@import initializer_list;
|
||||
|
||||
auto v = {1, 2, 3};
|
||||
int n = std::min({1, 2, 3});
|
||||
|
|
Loading…
Reference in New Issue