error: reference to ‘__detail’ is ambiguous

Ed Smith-Rowland 3dw4rd@verizon.net
Tue Jun 11 00:36:00 GMT 2013


On 06/09/2013 04:25 PM, Jonathan Wakely wrote:
> Ed, I'm seeing errors using -std=c++1y with this code:
>
> #include <chrono>
> #include <random>
>
> int main()
> {
> }
>
> I think this is due to you chrono literals patch, could you take a look please?
>
Here is a simple fix.  Just rename __detail to __select_type.

Built and tests on x86_64-linux.

OK?

Ed

-------------- next part --------------

2013-06-10  Ed Smith-Rowland  <3dw4rd@verizon.net>

	Fix library literals error involving namespace __detail.
	* include/std/chrono: Rename __detail to __select_type.
	* testsuite/20_util/duration/literals/ns_detail.cc: New.
-------------- next part --------------
Index: include/std/chrono
===================================================================
--- include/std/chrono	(revision 199930)
+++ include/std/chrono	(working copy)
@@ -785,7 +785,7 @@
   inline namespace literals {
   inline namespace chrono_literals {
 
-    namespace __detail {
+    namespace __select_type {
 
       using namespace __parse_int;
 
@@ -812,11 +812,11 @@
 
     template <char... _Digits>
       constexpr typename
-      __detail::_Select_type<__select_int::_Select_int<_Digits...>::value,
+      __select_type::_Select_type<__select_int::_Select_int<_Digits...>::value,
 			     chrono::hours>::type
       operator"" h()
       {
-	return __detail::_Select_type<
+	return __select_type::_Select_type<
 			  __select_int::_Select_int<_Digits...>::value,
 			  chrono::hours>::value;
       }
@@ -827,11 +827,11 @@
 
     template <char... _Digits>
       constexpr typename
-      __detail::_Select_type<__select_int::_Select_int<_Digits...>::value,
+      __select_type::_Select_type<__select_int::_Select_int<_Digits...>::value,
 			     chrono::minutes>::type
       operator"" min()
       {
-	return __detail::_Select_type<
+	return __select_type::_Select_type<
 			  __select_int::_Select_int<_Digits...>::value,
 			  chrono::minutes>::value;
       }
@@ -842,11 +842,11 @@
 
     template <char... _Digits>
       constexpr typename
-      __detail::_Select_type<__select_int::_Select_int<_Digits...>::value,
+      __select_type::_Select_type<__select_int::_Select_int<_Digits...>::value,
 			     chrono::seconds>::type
       operator"" s()
       {
-	return __detail::_Select_type<
+	return __select_type::_Select_type<
 			  __select_int::_Select_int<_Digits...>::value,
 			  chrono::seconds>::value;
       }
@@ -857,11 +857,11 @@
 
     template <char... _Digits>
       constexpr typename
-      __detail::_Select_type<__select_int::_Select_int<_Digits...>::value,
+      __select_type::_Select_type<__select_int::_Select_int<_Digits...>::value,
 			     chrono::milliseconds>::type
       operator"" ms()
       {
-	return __detail::_Select_type<
+	return __select_type::_Select_type<
 			  __select_int::_Select_int<_Digits...>::value,
 			  chrono::milliseconds>::value;
       }
@@ -872,11 +872,11 @@
 
     template <char... _Digits>
       constexpr typename
-      __detail::_Select_type<__select_int::_Select_int<_Digits...>::value,
+      __select_type::_Select_type<__select_int::_Select_int<_Digits...>::value,
 			     chrono::microseconds>::type
       operator"" us()
       {
-	return __detail::_Select_type<
+	return __select_type::_Select_type<
 			  __select_int::_Select_int<_Digits...>::value,
 			  chrono::microseconds>::value;
       }
@@ -887,11 +887,11 @@
 
     template <char... _Digits>
       constexpr typename
-      __detail::_Select_type<__select_int::_Select_int<_Digits...>::value,
+      __select_type::_Select_type<__select_int::_Select_int<_Digits...>::value,
 			     chrono::nanoseconds>::type
       operator"" ns()
       {
-	return __detail::_Select_type<
+	return __select_type::_Select_type<
 			  __select_int::_Select_int<_Digits...>::value,
 			  chrono::nanoseconds>::value;
       }
Index: testsuite/20_util/duration/literals/ns_detail.cc
===================================================================
--- testsuite/20_util/duration/literals/ns_detail.cc	(revision 0)
+++ testsuite/20_util/duration/literals/ns_detail.cc	(working copy)
@@ -0,0 +1,7 @@
+// { dg-options "-std=gnu++1y" }
+// { dg-do compile }
+
+// Test error: reference to '__detail' is ambiguous
+
+#include <chrono>
+#include <random>


More information about the Libstdc++ mailing list