-
Notifications
You must be signed in to change notification settings - Fork 12.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[C++20] [Modules] <ranges> cannot be included in more than one module #61317
Comments
@llvm/issue-subscribers-clang-modules |
Thanks for reporting this! Would you like to reduce the defect report? It will be pretty helpful. We can reduce the defect report by:
|
This reduced version reproduces the issue. // A.cppm
module;
#include "foo.h"
export module A; // B.cppm
module;
#include "foo.h"
export module B;
import A; // foo.h
#ifndef _FOO
#define _FOO
template <typename T> struct Foo {
Foo(T) {}
};
template <typename T> Foo(T &) -> Foo<T>;
struct Bar {
template <typename T>
requires requires { Foo{T()}; }
void baz() const {}
};
#endif The issue seems to be related to the deduction guide. If the requires clause is changed to |
This feels a lot like #60486. Note in particular "The practical effect of this bug is that |
Thank you! |
Clang issue [#61317](llvm/llvm-project#61317) being fixed removed the need for a stdlibc++ patch for this project.
Close llvm/llvm-project#61317 The root cause of the problem is that we profile TemplateName by the non-canonical decls so that the compiler thought they are two different types. But this is not true. We fixed the issue after we profile the template name by using the same name.
Close llvm/llvm-project#61317 The root cause of the problem is that we profile TemplateName by the non-canonical decls so that the compiler thought they are two different types. But this is not true. We fixed the issue after we profile the template name by using the same name.
Close llvm#61317 The root cause of the problem is that we profile TemplateName by the non-canonical decls so that the compiler thought they are two different types. But this is not true. We fixed the issue after we profile the template name by using the same name.
I have come across this change while working on another problem. The fix which was committed is not correct : The profile function is supposed to support structural comparison, not referential comparison. It's even inconsistent that it would arbitrarily pick referential comparisons for 'TemplateDecl' names, but pick structural for everything else. This can't be the real solution: When we build canonical types, we start with canonical components, and profiling these still does the right thing, because for canonical stuff, structural and referential comparisons are equivalent. This fix causes issues where TemplateNames would become canonicalized on the first spelling appearing in source, and their spellings in diagnostics becoming inconsistent. For example, some libcxx tests emitting diagnostics with different spellings depending on whether they were built with modules or not. |
This reverts the functional elements of commit 3e78fa8 and redoes it, by fixing the true root cause of #61317. A TemplateName can be non-canonical; profiling it based on the canonical name would result in inconsistent preservation of as-written information in the AST. The true problem in #61317 is that we would not consider the methods with requirements expression which contain DTSTs as the same in relation to merging of declarations when importing modules. The expressions would never match because they contained DTSTs pointing to different redeclarations of the same class template, but since canonicalization for them was broken, their canonical types would not match either. --- No changelog entry because #61317 was already claimed as fixed in previous release.
This reverts the functional elements of commit 3e78fa8 and redoes it, by fixing the true root cause of #61317. A TemplateName can be non-canonical; profiling it based on the canonical name would result in inconsistent preservation of as-written information in the AST. The true problem in #61317 is that we would not consider the methods with requirements expression which contain DTSTs as the same in relation to merging of declarations when importing modules. The expressions would never match because they contained DTSTs pointing to different redeclarations of the same class template, but since canonicalization for them was broken, their canonical types would not match either. --- No changelog entry because #61317 was already claimed as fixed in previous release.
This reverts the functional elements of commit 3e78fa8 and redoes it, by fixing the true root cause of #61317. A TemplateName can be non-canonical; profiling it based on the canonical name would result in inconsistent preservation of as-written information in the AST. The true problem in #61317 is that we would not consider the methods with requirements expression which contain DTSTs as the same in relation to merging of declarations when importing modules. The expressions would never match because they contained DTSTs pointing to different redeclarations of the same class template, but since canonicalization for them was broken, their canonical types would not match either. --- No changelog entry because #61317 was already claimed as fixed in previous release.
This reverts the functional elements of commit 3e78fa8 and redoes it, by fixing the true root cause of #61317. A TemplateName can be non-canonical; profiling it based on the canonical name would result in inconsistent preservation of as-written information in the AST. The true problem in #61317 is that we would not consider the methods with requirements expression which contain DTSTs as the same in relation to merging of declarations when importing modules. The expressions would never match because they contained DTSTs pointing to different redeclarations of the same class template, but since canonicalization for them was broken, their canonical types would not match either. --- No changelog entry because #61317 was already claimed as fixed in previous release.
…ype (#95202) This reverts the functional elements of commit 3e78fa8 and redoes it, by fixing the true root cause of #61317. A TemplateName can be non-canonical; profiling it based on the canonical name would result in inconsistent preservation of as-written information in the AST. The true problem in #61317 is that we would not consider the methods with requirements expression which contain DTSTs as the same in relation to merging of declarations when importing modules. The expressions would never match because they contained DTSTs pointing to different redeclarations of the same class template, but since canonicalization for them was broken, their canonical types would not match either. --- No changelog entry because #61317 was already claimed as fixed in previous release.
Compilation of the second file results in several errors like this
This is using Clang trunk and libstdc++ that is distributed with GCC 12.2.1.
The text was updated successfully, but these errors were encountered: