All pastes #926045 Raw Edit

int-char promotion?!

public text v1 · immutable
·published 2008-03-03 14:58 UTC
rendered paste body
	class String {
	public:
		operator const char*() const;
     
                String();
		String(char);
	private:
		friend String operator+ (const String& str1, const String& str2);
		friend String operator+ (const String& str1, const char* str2);
		friend String operator+ (const char* str1, const String& str2);
	};
	void testPlusRegOfft ()
	{
 		String inString;

		regmatch_t pm[2];

		strlen(inString + pm[1].rm_so); // typedef int regoff_t


GoStringTest.cpp: In member function `void GoStringTest::testPlusRegOfft()':
GoStringTest.cpp:59: ambiguous overload for `GoStringTest::String& + regoff_t&' 
   operator
GoStringTest.cpp:59: candidates are: operator+(const char*, int) <built-in>
GoStringTest.cpp:47:                 GoStringTest::String operator+(const 
   GoStringTest::String&, const GoStringTest::String&)
GoStringTest.cpp:48:                 GoStringTest::String operator+(const 
   GoStringTest::String&, const char*) <near match>
GoStringTest.cpp:49:                 GoStringTest::String operator+(const 
   char*, const GoStringTest::String&)
GoStringTest.cpp:49:                 GoStringTest::String operator+(const 
   char*, const GoStringTest::String&)
GoStringTest.cpp:48:                 GoStringTest::String operator+(const 
   GoStringTest::String&, const char*) <near match>
GoStringTest.cpp:47:                 GoStringTest::String operator+(const 
   GoStringTest::String&, const GoStringTest::String&)

	}

// what the heck?!