[cfe-dev] More windows breakage
Douglas Gregor
dgregor at apple.com
Wed Jul 1 08:13:53 PDT 2009
On Jul 1, 2009, at 7:55 AM, AlisdairM(public) wrote:
> Sorry - I'm in the middle of subscribing to the cfe-commits list so
> can't reply directly to the actual commit:
>
> Commit r74539 by Edwin Torok breaks at link time with MSVC.
>
> The cause is the following:
>
> +template<typename TargetInfo>
> +class OSTargetInfo : public TargetInfo {
> +protected:
> + virtual void getOSDefines(const LangOptions &Opts, const char
> *Triple,
> + std::vector<char> &Defines) const=0;
> +public:
> + OSTargetInfo(const std::string& triple) : TargetInfo(triple) {}
> + virtual void getTargetDefines(const LangOptions &Opts,
> + std::vector<char> &Defines) const {
> + TargetInfo::getTargetDefines(Opts, Defines);
> + getOSDefines(Opts, TargetInfo::getTargetTriple(), Defines);
> }
> -}
>
>
> Here, TargetInfo is used as a template parameter name, but it is
> also the name of the fundamental base class of types that will be
> used to instantiate the template. Therefore, the line
>
> TargetInfo::getTargetDefines(Opts, Defines);
>
> is being dispatched to the base class called TargetInfo, rather than
> the type referred to by the template parameter name TargetInfo. As
> this is a pure abstract method, I presumed static dispatch should
> have been a compile-time rather than link-time error, but apparently
> not with MSVC.
Weird.
> Patch attached.
... and committed. Thanks again!
- Doug
More information about the cfe-dev
mailing list