Skip to content
  • Nikolai Kosjar's avatar
    Clang: Tests: Use test data working with clang 3.6 *and* clang 3.8 · b0320387
    Nikolai Kosjar authored
    
    
    The test data produces different results when it is run with libclang
    3.6 and libclang 3.8. (lib)clang 3.8 will generate an error instead of a
    warning and suppress further diagnostics. See below.
    
    Use simpler test data that is agnostic to the different clang versions.
    
    $ cat input.cpp
        class X {
    	X(X&&) noexcept;
        };
    
        X::X(X&&) = default;
    
        int function()
        {
        }
    
    $ clang++-3.6 -fsyntax-only -std=c++11 input.cpp
        input.cpp:5:4: warning: 'X' is missing exception specification 'noexcept'
        X::X(X&&) = default;
           ^
    	      noexcept
        input.cpp:2:5: note: previous declaration is here
    	X(X&&) noexcept;
    	^
        input.cpp:9:1: warning: control reaches end of non-void function [-Wreturn-type]
        }
        ^
        2 warnings generated.
    
    $ clang++-3.8 -fsyntax-only -std=c++11 input.cpp
        input.cpp:5:4: error: 'X' is missing exception specification 'noexcept'
        X::X(X&&) = default;
           ^
    	      noexcept
        input.cpp:2:5: note: previous declaration is here
    	X(X&&) noexcept;
    	^
        1 error generated.
    
    Change-Id: I6d786a8b87eb4438fa8db36540db9358181b9a5b
    Reviewed-by: default avatarDavid Schulz <david.schulz@theqtcompany.com>
    b0320387