Skip to content

Commit 25a02c3

Browse files
committed
Revert "PR24076, PR33655, C++ CWG 1558: Consider the instantiation-dependence of"
This reverts commit d3bf0bb. This causes compilation in certain cases to fail. Reproducer TBD.
1 parent 19a0d0a commit 25a02c3

File tree

7 files changed

+4
-132
lines changed

7 files changed

+4
-132
lines changed

clang/include/clang/AST/Type.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5411,9 +5411,7 @@ class ElaboratedType final
54115411
ElaboratedType(ElaboratedTypeKeyword Keyword, NestedNameSpecifier *NNS,
54125412
QualType NamedType, QualType CanonType, TagDecl *OwnedTagDecl)
54135413
: TypeWithKeyword(Keyword, Elaborated, CanonType,
5414-
NamedType->getDependence() |
5415-
(NNS ? toTypeDependence(NNS->getDependence())
5416-
: TypeDependence::None)),
5414+
NamedType->getDependence()),
54175415
NNS(NNS), NamedType(NamedType) {
54185416
ElaboratedTypeBits.HasOwnedTagDecl = false;
54195417
if (OwnedTagDecl) {

clang/lib/AST/ItaniumMangle.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2578,10 +2578,6 @@ void CXXNameMangler::mangleType(QualType T) {
25782578
if (!TST->isTypeAlias())
25792579
break;
25802580

2581-
// FIXME: We presumably shouldn't strip off ElaboratedTypes with
2582-
// instantation-dependent qualifiers. See
2583-
// https://github.com/itanium-cxx-abi/cxx-abi/issues/114.
2584-
25852581
QualType Desugared
25862582
= T.getSingleStepDesugaredType(Context.getASTContext());
25872583
if (Desugared == T)

clang/test/CXX/drs/dr15xx.cpp

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -239,20 +239,6 @@ namespace dr1550 { // dr1550: yes
239239
}
240240
}
241241

242-
namespace dr1558 { // dr1558: 12
243-
#if __cplusplus >= 201103L
244-
template<class T, class...> using first_of = T;
245-
template<class T> first_of<void, typename T::type> f(int); // expected-note {{'int' cannot be used prior to '::'}}
246-
template<class T> void f(...) = delete; // expected-note {{deleted}}
247-
248-
struct X { typedef void type; };
249-
void test() {
250-
f<X>(0);
251-
f<int>(0); // expected-error {{deleted}}
252-
}
253-
#endif
254-
}
255-
256242
namespace dr1560 { // dr1560: 3.5
257243
void f(bool b, int n) {
258244
(b ? throw 0 : n) = (b ? n : throw 0) = 0;

clang/test/CodeGenCXX/mangle-template.cpp

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -342,23 +342,3 @@ namespace fixed_size_parameter_pack {
342342
template<int ...Ns> void f(A<unsigned, char, long long>::B<0, Ns...>);
343343
void g() { f<1, 2>({}); }
344344
}
345-
346-
namespace type_qualifier {
347-
template<typename T> using int_t = int;
348-
template<typename T> void f(decltype(int_t<T*>() + 1)) {}
349-
// FIXME: This mangling doesn't work: we need to mangle the
350-
// instantiation-dependent 'int_t' operand.
351-
// CHECK: @_ZN14type_qualifier1fIPiEEvDTplcvi_ELi1EE
352-
template void f<int*>(int);
353-
354-
// Note that this template has different constraints but would mangle the
355-
// same:
356-
//template<typename T> void f(decltype(int_t<typename T::type>() + 1)) {}
357-
358-
struct impl { using type = void; };
359-
template<typename T> using alias = impl;
360-
template<typename T> void g(decltype(alias<T*>::type(), 1)) {}
361-
// FIXME: Similarly we need to mangle the `T*` in here.
362-
// CHECK: @_ZN14type_qualifier1gIPiEEvDTcmcvv_ELi1EE
363-
template void g<int*>(int);
364-
}

clang/test/SemaTemplate/instantiation-dependence.cpp

Lines changed: 0 additions & 74 deletions
This file was deleted.

clang/test/SemaTemplate/partial-spec-instantiate.cpp

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ namespace rdar9169404 {
5151
X<bool, -1>::type value;
5252
#if __cplusplus >= 201103L
5353
// expected-error@-2 {{non-type template argument evaluates to -1, which cannot be narrowed to type 'bool'}}
54+
#else
55+
// expected-no-diagnostics
5456
#endif
5557
}
5658

@@ -96,19 +98,3 @@ namespace rdar39524996 {
9698
takesWrapperInContainer(c);
9799
}
98100
}
99-
100-
namespace InstantiationDependent {
101-
template<typename> using ignore = void; // expected-warning 0-1{{extension}}
102-
template<typename T, typename = void> struct A {
103-
static const bool specialized = false;
104-
};
105-
template<typename T> struct Hide { typedef void type; };
106-
template<typename T> struct A<T, Hide<ignore<typename T::type> >::type> {
107-
static const bool specialized = true;
108-
};
109-
110-
struct X {};
111-
struct Y { typedef int type; };
112-
_Static_assert(!A<X>::specialized, "");
113-
_Static_assert(A<Y>::specialized, "");
114-
}

clang/www/cxx_dr_status.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9162,7 +9162,7 @@ <h2 id="cxxdr">C++ defect report implementation status</h2>
91629162
<td><a href="https://wg21.link/cwg1558">1558</a></td>
91639163
<td>CD4</td>
91649164
<td>Unused arguments in alias template specializations</td>
9165-
<td class="unreleased" align="center">Clang 12</td>
9165+
<td class="none" align="center">Unknown</td>
91669166
</tr>
91679167
<tr id="1559">
91689168
<td><a href="https://wg21.link/cwg1559">1559</a></td>

0 commit comments

Comments
 (0)