[llvm-bugs] [Bug 26836] New: [ms] type conversion with a type named with two words cannot be compiled in if statement

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Mar 4 03:27:08 PST 2016


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

            Bug ID: 26836
           Summary: [ms] type conversion with a type named with two words
                    cannot be compiled in if statement
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: andrey.kuleshov at intel.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

!- the way MS compiler works is logical and explainable, because such behavior
is user friendly. 
clang can compile such line: 
   "if( long(t1) < t2 ) ;"

a little bit confusing for a user that this line cannot be compiled: 
   "if( unsigned long(t1) < t2 ) ;"

I suppose that this feature might be added to clang under fms-compability
option -!

=========Environment============
Language: c++
OS: Windows
Version: trunk

=========How to reproduce========
void f(int t1, unsigned long t2 )
{
   if( unsigned long(t1) < t2 ) ;
}

=========Error===================
>>> clang:
error: variable declaration in condition must have an initializer
   if( unsigned long(t1) < t2 ) ;
error: expected ')'
   if( unsigned long(t1) < t2 ) ;

>>> MSVC/intel icc compiler: no diagnostics

>>> gcc:  
error: expected primary-expression before ‘unsigned’
      if( unsigned long(t1) < t2 ) ;
error: expected ‘)’ before ‘unsigned’


Andrey Kuleshov
======
Software Engineer
Intel Compiler Team

-- 
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/20160304/81ba6ef6/attachment.html>


More information about the llvm-bugs mailing list