http://llvm.org/bugs/show_bug.cgi?id=21425

            Bug ID: 21425
           Summary: conversion string to char claims it's void
           Product: clang
           Version: 3.4
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected]
    Classification: Unclassified

The following piece of code (which is stupid, of course), produces an
unexpected error message about "void" instead of "std::string".

$ cat foo.cc
#include <string>

char c = char{std::string("foo")};

$ clang++-mp-3.5 --version
clang version 3.5.0 (branches/release_35 216817)
Target: x86_64-apple-darwin13.4.0
Thread model: posix

$ clang++-mp-3.5 -c foo.cc -std=c++11
foo.cc:3:10: error: no viable conversion from 'void' to 'char'
char c = char{std::string("foo")};
         ^   ~~~~~~~~~~~~~~~~~~~~
1 error generated.


Or more generally:

$ cat foo.cc
struct foo{};
int c = int{foo{}};


$ clang++-mp-3.5 -c foo.cc -std=c++11
foo.cc:2:9: error: no viable conversion from 'void' to 'int'
int c = int{foo{}};
        ^  ~~~~~~~
1 error generated.


$ g++-mp-4.9 -std=c++11 -c foo.cc
foo.cc:2:18: error: cannot convert 'foo' to 'int' in initialization
 int c = int{foo{}};
                  ^

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to