[LLVMbugs] [Bug 13764] New: MS compatibility: conditional operator accepts a single void non-throw expression operand

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Sep 4 08:24:31 PDT 2012


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

             Bug #: 13764
           Summary: MS compatibility: conditional operator accepts a
                    single void non-throw expression operand
           Product: clang
           Version: 3.1
          Platform: PC
        OS/Version: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: avakar at ratatanek.cz
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified


The following compiles cleanly under vc10, even with /Za.

    void foo() {
        1? (void)1: 1;
    }

clang (I assume correctly) reports

    error: left operand to ? is void, but right operand is of type 'int'

According to MSDN:
http://msdn.microsoft.com/en-us/library/e4213hs1(v=vs.71).aspx, the resulting
type of the above expression is deduced to be void. The same should happen in
clang and no error should be reported when -fms-compatibility is in effect.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list