https://github.com/tahonermann requested changes to this pull request.
The change to `QualType::getNonLValueExprType()` looks good to me, but I'm not sure what motivated the change to `PerformConstructorInitialization()`. I think some additional tests would be helpful too. I agree with @Fznamznon that the PR description could use more detail. The primary reason to drop the address space qualification on prvalues is that prvalues don't formally have an address and therefore exist independently of any address space. If materialized, they will be materialized in an address space chosen by the compiler. I find the following example motivational. I think it would make for a good SemaCXX test as well. https://godbolt.org/z/d358qxY4a. ```c++ struct S { S(int); // Ok; member functions can be const qualified. void f() const; // Error; member function cannot be address space qualified. void f() __attribute__((address_space(1))); }; using const_int = const int; using as1_int = __attribute__((address_space(1))) int; using const_S = const S; using as1_S = __attribute__((address_space(1))) S; void f() { // Ok; const is dropped on prvalues of non-class type. (void)(const_int{1}); // Ok; address space is dropped on prvalues of non-class type. (void)(as1_int{1}); // Ok; const is retained on prvalues of class type; const // qualified member function called. const_S{1}.f(); // Error; address space is retained on prvalues of class type, // but no constructor or member function can be called. as1_S{1}.f(); } ``` Address space qualifiers are currently dropped for C code (for both non-class and class types). It would be good to add a test for C assuming there isn't a suitable one already in place. Perhaps something like https://godbolt.org/z/MnMK6YW6r. https://github.com/llvm/llvm-project/pull/221233 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
