forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[libc++] __uglify internal member names of iterators in
bitset
(llv…
…m#111127) [template.bitset.general] indicates that `bitset` shouldn't have member typedef-names `iterator` and `const_iterator`. Currently libc++'s typedef-names are causing ambiguity in name lookup, which isn't conforming. As these iterator types are themselves useful, I think we should just use __uglified member typedef-names for them. Fixes llvm#111125
- Loading branch information
1 parent
1f919aa
commit 159d694
Showing
3 changed files
with
72 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
libcxx/test/std/utilities/template.bitset/bitset.members/nonstdmem.uglified.compile.pass.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://llvm.org/LICENSE.txt for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
// <bitset> | ||
|
||
// This test ensures that we don't use a non-uglified name 'iterator' and | ||
// 'const_iterator' in the implementation of bitset. | ||
// | ||
// See https://github.com/llvm/llvm-project/issues/111125. | ||
|
||
#include <cstddef> | ||
#include <bitset> | ||
#include <type_traits> | ||
|
||
struct my_base { | ||
typedef int* iterator; | ||
typedef const int* const_iterator; | ||
}; | ||
|
||
template <std::size_t N> | ||
struct my_derived : my_base, std::bitset<N> {}; | ||
|
||
static_assert(std::is_same<my_derived<0>::iterator, int*>::value, ""); | ||
static_assert(std::is_same<my_derived<1>::iterator, int*>::value, ""); | ||
static_assert(std::is_same<my_derived<8>::iterator, int*>::value, ""); | ||
static_assert(std::is_same<my_derived<12>::iterator, int*>::value, ""); | ||
static_assert(std::is_same<my_derived<16>::iterator, int*>::value, ""); | ||
static_assert(std::is_same<my_derived<32>::iterator, int*>::value, ""); | ||
static_assert(std::is_same<my_derived<48>::iterator, int*>::value, ""); | ||
static_assert(std::is_same<my_derived<64>::iterator, int*>::value, ""); | ||
static_assert(std::is_same<my_derived<96>::iterator, int*>::value, ""); | ||
|
||
static_assert(std::is_same<my_derived<0>::const_iterator, const int*>::value, ""); | ||
static_assert(std::is_same<my_derived<1>::const_iterator, const int*>::value, ""); | ||
static_assert(std::is_same<my_derived<8>::const_iterator, const int*>::value, ""); | ||
static_assert(std::is_same<my_derived<12>::const_iterator, const int*>::value, ""); | ||
static_assert(std::is_same<my_derived<16>::const_iterator, const int*>::value, ""); | ||
static_assert(std::is_same<my_derived<32>::const_iterator, const int*>::value, ""); | ||
static_assert(std::is_same<my_derived<48>::const_iterator, const int*>::value, ""); | ||
static_assert(std::is_same<my_derived<64>::const_iterator, const int*>::value, ""); | ||
static_assert(std::is_same<my_derived<96>::const_iterator, const int*>::value, ""); |