Changeset ec6c040


Ignore:
Timestamp:
Mar 19, 2018, 2:07:42 PM (6 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, with_gc
Children:
2348881
Parents:
6470882
git-author:
Rob Schluntz <rschlunt@…> (03/15/18 14:48:28)
git-committer:
Rob Schluntz <rschlunt@…> (03/19/18 14:07:42)
Message:

Add warning for rvalue-to-reference conversion

Location:
src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/Common/SemanticError.h

    r6470882 rec6c040  
    3838constexpr const char * const WarningFormats[] = {
    3939        "self assignment of expression: %s",
     40        "rvalue to reference conversion",
    4041};
    4142
    4243enum class Warning {
    4344        SelfAssignment,
     45        RvalueToReferenceConversion,
    4446        NUMBER_OF_WARNINGS, //This MUST be the last warning
    4547};
     
    5052);
    5153
    52 #define SemanticWarning(loc, id, ...) SemanticWarningImpl(loc, id, WarningFormats[(int)id], __VA_ARGS__)
     54// ## used here to allow empty __VA_ARGS__
     55#define SemanticWarning(loc, id, ...) SemanticWarningImpl(loc, id, WarningFormats[(int)id], ## __VA_ARGS__)
    5356
    5457void SemanticWarningImpl (CodeLocation loc, Warning warn, const char * const fmt, ...) __attribute__((format(printf, 3, 4)));
  • src/GenPoly/Lvalue.cc

    r6470882 rec6c040  
    296296                                //   int && __ref_tmp_2 = &__ref_tmp_1;
    297297                                //   &__ref_tmp_2;
     298                                SemanticWarning( castExpr->arg->location, Warning::RvalueToReferenceConversion );
    298299
    299300                                static UniqueName tempNamer( "__ref_tmp_" );
Note: See TracChangeset for help on using the changeset viewer.