Before checking that template partial specialization is "reachable",
ensure it exists.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
clang/lib/Sema/SemaCXXScopeSpec.cpp | ||
---|---|---|
134–135 | I would expect 'hasReachableDefinition' to check boht reachable AND definition :) That said, I doubt the 'missing import' error is an appropriate one here. | |
clang/test/SemaCXX/undefined-partial-specialization.cpp | ||
13 | I don't think this is correct. The diagnostic is inaccurate, it DOES refer to a class template partial specialization (I can see it on line 9!), but the problem is that it is incomplete. |
clang/lib/Sema/SemaCXXScopeSpec.cpp | ||
---|---|---|
134–135 |
Well, it is implemented in a way that it actually expects definition to be present. In some other places where 'hasReachableDefinition' is called there is also a check that definition exists prior the call. |
clang/test/SemaCXX/undefined-partial-specialization.cpp | ||
---|---|---|
13 | Huh, it seems it was my change that made this diagnostic inaccurate. I was under impression that it shouldn't have done this. |
clang/lib/Sema/SemaCXXScopeSpec.cpp | ||
---|---|---|
134–135 | Hrmph, ok then. Perhaps it is not the right place to change things anyway. | |
clang/test/SemaCXX/undefined-partial-specialization.cpp | ||
13 | Yes, I would definitely expect the 'out-of-line-definition' diagnostic, like we do for non-partial specs, and the C++17 behavior. Interesting that we've messed this up for C++20, should be fun to track down/figure out! |
clang/test/SemaCXX/undefined-partial-specialization.cpp | ||
---|---|---|
13 |
hasReachableDefinition calls hasAcceptableDefinition that early-exits if support for modules is not required. |
clang/test/SemaCXX/undefined-partial-specialization.cpp | ||
---|---|---|
2 | nit: can you add a c++17 run line here too? Only 20 crashed, but I want to make sure these have hte same behavior. |
clang/lib/Sema/SemaCXXScopeSpec.cpp | ||
---|---|---|
134–135 | So I see in another location we are basically checking !isBeginDefined() and in another place hasCompleteDefinition(). It is not clear to me if these are all basically checking the same thing or if we should figure out what is the right thing to check and do that everywhere. |
clang/lib/Sema/SemaCXXScopeSpec.cpp | ||
---|---|---|
134–135 | I suppose you meant isBeingDefined(). So, IMO isBeingDefined() is not exactly the same as having a definition, this is set to true when TagDecl::startDefinition I suppose this should be done when parser meets a definition so at this point it can't be or have a complete definition. But at the places where !isBeingDefined() is checked prior hasReachableDefinition I saw a pointer representing a definition checked for not being null. Interestingly, hasReachableDefinition() early exits if isBeingDefined() returns true, so probably this check additional doesn't make sense at all. I can't grep hasCompleteDefinition() either, so I suppose you meant isCompleteDefinition(), I think this is basically the same thing as having definition and additionally the declaration through which the method called is checked that IT IS the definition. I'm not sure we have to require it here. |
I would expect 'hasReachableDefinition' to check boht reachable AND definition :)
That said, I doubt the 'missing import' error is an appropriate one here.