Results 1 to 1 of 1

Thread: Duplicate using statement leads to strange compiler errors

  1. #1
    Join Date
    Jan 2017
    Posts
    1
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Duplicate using statement leads to strange compiler errors

    Hello,

    While debugging a strange compiler error in my project, I seem to have come across a weird bug in the MSVC compiler parser.

    The problem occurs when having a duplicate using statement to create an alias for a templated class, and only if the <QCoreApplication> header file is included.

    I'm trying to figure out if there is something inherently wrong in having the duplicate alias (is it legal C++?) or wether it is just a strange edge case that is happening in MSVC.


    A simple test case which produces a compiler error can be found in the following gist, with details of my build environment:

    https://gist.github.com/mnaamani/44a...6fce455e77aee7

    Can anyone replicate the compiler error?

    C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE\xstring(1596): error C3536: '_Mydata': cannot be used before it is initialized
    C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE\xstring(1596): error C2440: '<function-style-cast>': cannot convert from 'int' to 'std::_String_iterator<std::_String_val<std::_Simp le_types<wchar_t>>>'



    Regards,
    Mokhtar


    Added after 31 minutes:


    Its actually possible to produce the compiler error with just adding `#include <string>` so it doesn't appear to be specific to Qt.
    Last edited by mokhtar; 14th January 2017 at 09:47.

Similar Threads

  1. Replies: 5
    Last Post: 18th February 2016, 14:10
  2. Replies: 0
    Last Post: 23rd December 2013, 11:13
  3. Strange behavior of return statement
    By Raadush in forum Qt Programming
    Replies: 8
    Last Post: 11th October 2012, 10:31
  4. Qt Creator Parse compiler errors of a non gcc compiler
    By kiozen in forum Qt Tools
    Replies: 4
    Last Post: 4th July 2011, 01:34
  5. Strange compiler behaviour (compiler passes wrong argument)
    By SasaVilic in forum General Programming
    Replies: 2
    Last Post: 2nd November 2010, 11:36

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.