[llvm-bugs] [Bug 47429] New: cannot initialize a variable of type 'unsigned char *' with an lvalue of type 'int'

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Sep 5 07:24:32 PDT 2020


https://bugs.llvm.org/show_bug.cgi?id=47429

            Bug ID: 47429
           Summary: cannot initialize a variable of type 'unsigned char *'
                    with an lvalue of type 'int'
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: tangyixuan at mail.dlut.edu.cn
                CC: blitzrakete at gmail.com, dgregor at apple.com,
                    erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
                    richard-llvm at metafoo.co.uk

clang emits an error in the following code, while g++ accepts it. Is this
right?

$ cat s.cpp

template < class C > class A {
        void F ( int a ){
                unsigned char * c = a;}
};

$ clang++ -c s.cpp
s.cpp:3:26: error: cannot initialize a variable of type 'unsigned char *' with
an lvalue of type 'int'
                unsigned char * c = a;}
                                ^   ~
1 error generated.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200905/e6ca4eee/attachment.html>


More information about the llvm-bugs mailing list