shafik added inline comments.
================
Comment at: clang/test/CXX/temp/temp.arg/temp.arg.nontype/p1.cpp:204
+#if __cplusplus == 201703L
+ // cxx17-error@-3 {{non-type template argument refers to subobject '(int
*)1'}}
+#endif
----------------
Shouldn't this be an error b/c it is a temporary? What is `(int*)1` a subobject
of?
================
Comment at: clang/test/SemaTemplate/temp_arg_nontype_cxx20.cpp:21
+using IPn = IntPtr<&n + 1>;
+using IPn = IntPtr<&n + 1>;
----------------
`using IPn = IntPtr<&n + 2>` should be an error since that would be out of
bounds, while `+1` is ok b/c it is one past the end as long as we don't deref.
================
Comment at: clang/test/SemaTemplate/temp_arg_nontype_cxx20.cpp:21
+using IPn = IntPtr<&n + 1>;
+using IPn = IntPtr<&n + 1>;
----------------
shafik wrote:
> `using IPn = IntPtr<&n + 2>` should be an error since that would be out of
> bounds, while `+1` is ok b/c it is one past the end as long as we don't deref.
gcc reject this one but I think their pointer math is wonky here:
https://godbolt.org/z/fhMqPPefG
================
Comment at: clang/test/SemaTemplate/temp_arg_nontype_cxx20.cpp:26
-using IP3 = IntPtr<&s.n[3]>; // FIXME expected-error {{refers to subobject}}
-using IP3 = IntPtr<s.n + 3>; // FIXME expected-error {{refers to subobject}}
+using IP3 = IntPtr<&s.n[3]>;
+using IP3 = IntPtr<s.n + 3>;
----------------
We should reject `IntPtr<&s.n[5]>;` again b/c it is out of bounds.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D140996/new/
https://reviews.llvm.org/D140996
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits