Index: lib/Sema/SemaExceptionSpec.cpp =================================================================== --- lib/Sema/SemaExceptionSpec.cpp +++ lib/Sema/SemaExceptionSpec.cpp @@ -44,7 +44,8 @@ // All the problem cases are member functions named "swap" within class // templates declared directly within namespace std. - if (!RD || RD->getEnclosingNamespaceContext() != getStdNamespace() || + if (!RD || !getStdNamespace() || + !RD->getEnclosingNamespaceContext()->Equals(getStdNamespace()) || !RD->getIdentifier() || !RD->getDescribedClassTemplate() || !D.getIdentifier() || !D.getIdentifier()->isStr("swap")) return false; Index: test/Modules/Inputs/PR28423/Allocator.h =================================================================== --- /dev/null +++ test/Modules/Inputs/PR28423/Allocator.h @@ -0,0 +1,3 @@ + +#include "SmallVector.h" +#include "Memory.h" Index: test/Modules/Inputs/PR28423/Memory.h =================================================================== --- /dev/null +++ test/Modules/Inputs/PR28423/Memory.h @@ -0,0 +1 @@ +#include Index: test/Modules/Inputs/PR28423/SmallVector.h =================================================================== --- /dev/null +++ test/Modules/Inputs/PR28423/SmallVector.h @@ -0,0 +1,7 @@ + +#include "iterator_range.h" +#include +namespace std { +template > class vector; +} + Index: test/Modules/Inputs/PR28423/StringMap.h =================================================================== --- /dev/null +++ test/Modules/Inputs/PR28423/StringMap.h @@ -0,0 +1,4 @@ +#include "StringRef.h" +#include "Allocator.h" +#include "iterator_range.h" +namespace std {} Index: test/Modules/Inputs/PR28423/StringRef.h =================================================================== --- /dev/null +++ test/Modules/Inputs/PR28423/StringRef.h @@ -0,0 +1 @@ +namespace llvm{} Index: test/Modules/Inputs/PR28423/iterator_range.h =================================================================== --- /dev/null +++ test/Modules/Inputs/PR28423/iterator_range.h @@ -0,0 +1 @@ +namespace llvm {} Index: test/Modules/Inputs/PR28423/module.modulemap =================================================================== --- /dev/null +++ test/Modules/Inputs/PR28423/module.modulemap @@ -0,0 +1,6 @@ +module "StringRef.h" {header "StringRef.h" export *} +module "iterator_range.h" {header "iterator_range.h" export *} +module "SmallVector.h" {header "SmallVector.h" export *} +module "StringMap.h" {header "StringMap.h" export *} +module "Memory.h" {header "Memory.h" export *} +module "Allocator.h" {header "Allocator.h" export *} Index: test/Modules/Inputs/PR28423/queue =================================================================== --- /dev/null +++ test/Modules/Inputs/PR28423/queue @@ -0,0 +1,11 @@ +#pragma GCC system_header +namespace std { +template > +class priority_queue { + _Compare comp; + +public: + void swap(priority_queue __pq) noexcept(noexcept(swap(comp, comp))); +}; +} Index: test/Modules/Inputs/PR28423/string =================================================================== --- /dev/null +++ test/Modules/Inputs/PR28423/string @@ -0,0 +1,9 @@ +#ifndef _GLIBCXX_STRING +#define _GLIBCXX_STRING +namespace std { +template void swap(_Tp, _Tp); +template class allocator; +template struct greater {}; +template struct less; +} +#endif Index: test/Modules/pr28423.cpp =================================================================== --- /dev/null +++ test/Modules/pr28423.cpp @@ -0,0 +1,11 @@ +// RUN: rm -rf %t +// RUN: %clang_cc1 -std=c++11 -I%S/Inputs/PR28423 -verify %s +// RUN: %clang_cc1 -std=c++11 -fmodules -fmodule-map-file=%S/Inputs/PR28423/module.modulemap -fmodules-cache-path=%t -I%S/Inputs/PR28423/ -verify %s + +#include "StringMap.h" +#include + +std::priority_queue, std::greater> a,b; +void fn1() { a.swap(b); } + +// expected-no-diagnostics \ No newline at end of file