Implement LWG 2835 - fix <tgmath.h>

llvm-svn: 324923
Cr-Mirrored-From: sso://chromium.googlesource.com/_direct/external/github.com/llvm/llvm-project
Cr-Mirrored-Commit: 5012793e0512f534432fb35c3a0d12162301436b
diff --git a/include/tgmath.h b/include/tgmath.h
index fbe1e82..aba8749 100644
--- a/include/tgmath.h
+++ b/include/tgmath.h
@@ -14,16 +14,24 @@
 /*
     tgmath.h synopsis
 
-#include <complex.h>
-#include <math.h>
+#include <ctgmath>
 
 */
 
-#include <complex.h>
-#include <math.h>
+#include <__config>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #pragma GCC system_header
 #endif
 
+#ifdef __cplusplus
+
+#include <ctgmath>
+
+#else  // __cplusplus
+
+#include_next <tgmath.h>
+
+#endif  // __cplusplus
+
 #endif  // _LIBCPP_TGMATH_H