[llvm-bugs] [Bug 39604] New: Checking for optional availability does not work like advertised in the standard
via llvm-bugs
llvm-bugs at lists.llvm.org
Fri Nov 9 10:42:13 PST 2018
https://bugs.llvm.org/show_bug.cgi?id=39604
Bug ID: 39604
Summary: Checking for optional availability does not work like
advertised in the standard
Product: libc++
Version: unspecified
Hardware: PC
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: All Bugs
Assignee: unassignedclangbugs at nondot.org
Reporter: ldionne at apple.com
CC: llvm-bugs at lists.llvm.org, mclow.lists at gmail.com
The following code does not compile using libc++ trunk:
----------------------------------------------------------
#if __has_include(<optional>)
# include <optional>
# if __cpp_lib_optional >= 201603
# define have_optional 1
# endif
#elif __has_include(<experimental/optional>)
# include <experimental/optional>
# if __cpp_lib_experimental_optional >= 201411
# define have_optional 1
# define experimental_optional 1
# endif
#endif
#ifndef have_optional
# define have_optional 0
#endif
int main() {
#ifdef have_optional
std::optional<int> i;
#endif
#ifdef experimental_optional
std::experimental::optional<int> j;
#endif
}
----------------------------------------------------------
The embarrassing part is that the optional-checking code is copy-pasted from
[cpp.cond] 14.1/15.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20181109/ae8333b1/attachment.html>
More information about the llvm-bugs
mailing list