Tadeus Prastowo
2018-07-19 15:15:07 UTC
Hi!
The following program is ill-formed or not for its use of volatile
constexpr variables?
template<typename T, T v> struct X {};
int main() {
static constexpr volatile int a = 3;
constexpr volatile int b = 2;
return (sizeof(X<decltype(a), a>) + sizeof(X<decltype(b), b>));
}
I think it is ill-formed based on
http://eel.is/c++draft/temp.arg.nontype (#1 and #2) and
http://eel.is/c++draft/expr.const#2.7. However...
GCC 8.1 compiles fine (https://godbolt.org/g/o8UPiJ), MSVC 19 2017
compiles fine too (https://godbolt.org/g/rvyMtX), but not clang-6.0
(https://godbolt.org/g/HUQXUM) and not GCC 5.5
(https://godbolt.org/g/MQRCdE).
That's why I ask about this matter in this list. Thank you.
--
Best regards,
Tadeus
The following program is ill-formed or not for its use of volatile
constexpr variables?
template<typename T, T v> struct X {};
int main() {
static constexpr volatile int a = 3;
constexpr volatile int b = 2;
return (sizeof(X<decltype(a), a>) + sizeof(X<decltype(b), b>));
}
I think it is ill-formed based on
http://eel.is/c++draft/temp.arg.nontype (#1 and #2) and
http://eel.is/c++draft/expr.const#2.7. However...
GCC 8.1 compiles fine (https://godbolt.org/g/o8UPiJ), MSVC 19 2017
compiles fine too (https://godbolt.org/g/rvyMtX), but not clang-6.0
(https://godbolt.org/g/HUQXUM) and not GCC 5.5
(https://godbolt.org/g/MQRCdE).
That's why I ask about this matter in this list. Thank you.
--
Best regards,
Tadeus
--
---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-discussion+***@isocpp.org.
To post to this group, send email to std-***@isocpp.org.
Visit this group at https://groups.google.com/a/isocpp.org/group/std-discussion/.
---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-discussion+***@isocpp.org.
To post to this group, send email to std-***@isocpp.org.
Visit this group at https://groups.google.com/a/isocpp.org/group/std-discussion/.