Diagnostic is not specific enough when when scoped enumeration requires a explicit conversion for binary operations (original) (raw)

Bugzilla Link 23891
Version unspecified
OS All
CC @DougGregor,@Weverything

Extended Description

I just got the worst syntax error message I've seen in a long time:

In file included from ../lib/CodeGen/PostRASchedulerList.cpp:27:
../include/llvm/Analysis/AliasAnalysis.h:129:57: error: invalid operands to binary expression ('llvm::FunctionModRefLocation' and 'llvm::ModRefInfo')
  DoesNotAccessMemory = FunctionModRefLocation::Nowhere | ModRefInfo::NoModRef,
                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~
../include/llvm/Analysis/AliasAnalysis.h:137:48: error: invalid operands to binary expression ('llvm::FunctionModRefLocation' and 'llvm::ModRefInfo')
      FunctionModRefLocation::ArgumentPointees | ModRefInfo::Ref,
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~
../include/llvm/Analysis/AliasAnalysis.h:145:48: error: invalid operands to binary expression ('llvm::FunctionModRefLocation' and 'llvm::ModRefInfo')
      FunctionModRefLocation::ArgumentPointees | ModRefInfo::ModRef,
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~
../include/llvm/Analysis/AliasAnalysis.h:153:54: error: invalid operands to binary expression ('llvm::FunctionModRefLocation' and 'llvm::ModRefInfo')
  OnlyReadsMemory = FunctionModRefLocation::Anywhere | ModRefInfo::Ref,
                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~

The bug is that these are scoped enumerations and so there is no | operator (it would require an implicit conversion to int). But the error message literally tells me nothing other than that there is an error. =[ =[ =[