https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79624
Bug ID: 79624 Summary: comma separate auto variables deduce different types under dependent lookup Product: gcc Version: 6.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: rhainin1 at binghamton dot edu Target Milestone: --- The following should fail to compile (does under clang) since auto is supposed to deduce to one type. #include <type_traits> #include <string> struct Cls { int get_int() const { return {}; } std::string get_string() const { return {}; } int i_; std::string s_; }; template <typename T> void deducer(T& t) { auto i = t.get_int(), s = t.get_string(); // this is invalid auto i2 = t.i_, s2 = t.s_; // this is invalid static_assert(std::is_same<decltype(i), int>{}, ""); // passes static_assert(std::is_same<decltype(s), std::string>{}, ""); //passes } int main() { Cls c; deducer(c); }