Skip to content

Commit 8423cef

Browse files
committed
Check only the aggregates, matching GCC's behavior
1 parent b32afd2 commit 8423cef

File tree

2 files changed

+13
-22
lines changed

2 files changed

+13
-22
lines changed

clang/lib/Sema/SemaOverload.cpp

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8064,32 +8064,20 @@ bool Sema::CheckNonDependentConversions(
80648064
// A speculative workaround for self-dependent constraint bugs that manifest
80658065
// after CWG2369.
80668066
// FIXME: Add references to the standard once P3606 is adopted.
8067-
auto MaybeInvolveUserDefinedConversion = [&](QualType ParmType,
8067+
auto MaybeInvolveUserDefinedConversion = [&](QualType ParamType,
80688068
QualType ArgType) {
8069-
ParmType = ParmType.getNonReferenceType();
8069+
ParamType = ParamType.getNonReferenceType();
80708070
ArgType = ArgType.getNonReferenceType();
8071-
bool PointerConv = ParmType->isPointerType() && ArgType->isPointerType();
8071+
bool PointerConv = ParamType->isPointerType() && ArgType->isPointerType();
80728072
if (PointerConv) {
8073-
ParmType = ParmType->getPointeeType();
8073+
ParamType = ParamType->getPointeeType();
80748074
ArgType = ArgType->getPointeeType();
80758075
}
80768076

8077-
if (auto *RT = ParmType->getAs<RecordType>())
8077+
if (auto *RT = ParamType->getAs<RecordType>())
80788078
if (auto *RD = dyn_cast<CXXRecordDecl>(RT->getDecl());
8079-
RD && RD->hasDefinition()) {
8080-
if (llvm::any_of(LookupConstructors(RD), [](NamedDecl *ND) {
8081-
auto Info = getConstructorInfo(ND);
8082-
if (!Info)
8083-
return false;
8084-
CXXConstructorDecl *Ctor = Info.Constructor;
8085-
/// isConvertingConstructor takes copy/move constructors into
8086-
/// account!
8087-
return !Ctor->isCopyOrMoveConstructor() &&
8088-
Ctor->isConvertingConstructor(
8089-
/*AllowExplicit=*/true);
8090-
}))
8091-
return true;
8092-
}
8079+
RD && RD->hasDefinition() && !RD->isAggregate())
8080+
return true;
80938081

80948082
if (auto *RT = ArgType->getAs<RecordType>())
80958083
if (auto *RD = dyn_cast<CXXRecordDecl>(RT->getDecl());

clang/test/SemaTemplate/concepts-recursive-inst.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,9 @@ int main() {
268268
}
269269

270270
// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99599#c22
271-
namespace GCC_99599_2 {
271+
// FIXME: Is this valid??
272+
#if 0
273+
namespace FAILED_GCC_99599_2 {
272274

273275
template<typename T> class indirect {
274276
public:
@@ -284,12 +286,13 @@ indirect<int> i;
284286
bool b = i == 1;
285287

286288
}
289+
#endif
287290

291+
#if 0
288292
namespace FAILED_GCC_110160 {
289293
// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110160
290294
// Current heuristic FAILED; GCC trunk also failed
291295
// https://godbolt.org/z/r3Pz9Tehz
292-
#if 0
293296
#include <sstream>
294297
#include <string>
295298

@@ -309,6 +312,6 @@ S& operator<<(S& s, UnrelatedType) {
309312
static_assert(!StreamCanReceiveString<NotAStream>);
310313

311314
static_assert(StreamCanReceiveString<std::stringstream>);
312-
#endif
313315
}
316+
#endif
314317
}

0 commit comments

Comments
 (0)