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: unassignedclangb...@nondot.org
Reporter: ldio...@apple.com
CC: llvm-bugs@lists.llvm.org, mclow.li...@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs