help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Bug? std::string promoted to bool???


From: U.Mutlu
Subject: Bug? std::string promoted to bool???
Date: Wed, 13 May 2015 04:47:26 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:40.0) Gecko/20100101 Firefox/40.0 SeaMonkey/2.37a1

Why does this compile?
The 2nd par should be a bool not a std::string.
IMO the compiler should generate a warning (actually even an error) about it.

#include <string>

struct TS {};

bool func(const TS& S, const bool f, const std::string s = "")
  {
    //...
    return f;
  }

int main()
  {
    TS S;
    func(S, "X");   // <-- HERE
    return 0;
  }


--
Thx
Uenal





reply via email to

[Prev in Thread] Current Thread [Next in Thread]